After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706025 - view: don't hit tracker every time the user scrolls
view: don't hit tracker every time the user scrolls
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-14 20:25 UTC by Giovanni Campagna
Modified: 2013-08-17 12:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
view: don't hit tracker every time the user scrolls (1.88 KB, patch)
2013-08-14 20:25 UTC, Giovanni Campagna
none Details | Review
view: don't hit tracker every time the user scrolls (2.90 KB, patch)
2013-08-15 19:37 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2013-08-14 20:25:48 UTC
Cache the number of items in the fully loaded view the first time
it's needed, and use that value for all future scrolling.

Note: if we ever support watching the library for changes, we need
to invalidate the cache.
Comment 1 Giovanni Campagna 2013-08-14 20:25:50 UTC
Created attachment 251651 [details] [review]
view: don't hit tracker every time the user scrolls
Comment 2 Giovanni Campagna 2013-08-15 19:37:50 UTC
Created attachment 251766 [details] [review]
view: don't hit tracker every time the user scrolls

Cache the number of items in the fully loaded view the first time
it's needed, and use that value for all future scrolling.

Note: if we ever support watching the library for changes, we need
to invalidate the cache.
Comment 3 Arnel Borja 2013-08-16 12:15:43 UTC
Review of attachment 251766 [details] [review]:

::: gnomemusic/view.py
@@ +106,3 @@
+        if self._cached_count < 0:
+            self._cached_count = Widgets.get_count(self.countQuery)
+        return self._cached_count = self._offset

Do you mean "return self._cached_count - self._offset" here? The older patch is not the same as the new one. Also it crashes with this:

  Traceback (most recent call last):
  • File "./gnome-music", line 32 in <module>
    from gnomemusic.application import Application
  • File "/home/kyoushuu/Devel/jhbuild/gnome-music/gnomemusic/application.py", line 3 in <module>
    from gnomemusic.window import Window
  • File "/home/kyoushuu/Devel/jhbuild/gnome-music/gnomemusic/window.py", line 7 in <module>
    import gnomemusic.view as Views
  • File "/home/kyoushuu/Devel/jhbuild/gnome-music/gnomemusic/view.py", line 108
    return self._cached_count = self._offset

::: gnomemusic/widgets.py
@@ +409,3 @@
+        if self._cached_count < 0:
+            self._cached_count = Widgets.get_count(self.countQuery)
+        return self._cached_count = self._offset

Same as the other one.
Comment 4 Arnel Borja 2013-08-16 13:38:17 UTC
Review of attachment 251766 [details] [review]:

::: gnomemusic/widgets.py
@@ +20,1 @@
+def get_count(countQuery):

This method is renamed and parameters are changed, but a call to this in AllArtistsAlbums._get_remaining_item_count was not updated.

@@ +408,3 @@
     def _get_remaining_item_count(self):
+        if self._cached_count < 0:
+            self._cached_count = Widgets.get_count(self.countQuery)

This code is inside widgets.py, so Widgets.get_count should be get_count here.
Comment 5 Arnel Borja 2013-08-17 12:31:57 UTC
Comment on attachment 251766 [details] [review]
view: don't hit tracker every time the user scrolls

I committed a modified version of this patch as 3dc9dcc4b. Sorry, I did a mistake on pushing it, so I reverted it and pushed a new one.
Comment 6 Arnel Borja 2013-08-17 12:32:17 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.