Hello, Wilfred!

On Wed, 2007-09-26 at 04:59 -0700, Wilfred van Rooijen wrote:
> yes, I'd be willing to help you out on this subject if
> you want to. I have a cable internet connection.
> Inside the house, I have wireless, so the max download
> bandwidth is about 600 KB/s. If I use a wired
> connection, it can be as high as 1.2 MB/s. I have
> several feeds with high bandwidth I frequently use.
> 
> BTW, I also use DownThemAll on Firefox every once in a
> while, and that will download @ maximum velocity with
> status updates and all, but does not take an
> appreciable amount of CPU time. 

I've tried to limit the updates sent to the download status manager by
limiting the number of updates per second (currently 3).

Please apply the attached patch to a local checkout of the current SVN
trunk head, and tell me if this solves your problems. If you run the svn
gpodder with "make test", you should see a bunch of "Skipping GUI
update." lines when downloading files.

Does this solve the performance/CPU usage bug for you?

Thomas
Index: src/gpodder/download.py
===================================================================
--- src/gpodder/download.py	(revision 434)
+++ src/gpodder/download.py	(working copy)
@@ -67,6 +67,8 @@
 
 
 class DownloadThread(threading.Thread):
+    MAX_UPDATES_PER_SEC = 3
+
     def __init__( self, channel, episode):
         threading.Thread.__init__( self)
         self.setDaemon( True)
@@ -87,6 +89,7 @@
         self.speed = _('Queued')
         self.progress = 0.0
         self.downloader = DownloadURLOpener( self.channel)
+        self.last_update = 0.0
 
     def cancel( self):
         self.cancelled = True
@@ -98,7 +101,11 @@
             self.progress = 100.0
 
         self.calculate_speed( count, blockSize)
-        services.download_status_manager.update_status( self.download_id, speed = self.speed, progress = self.progress)
+        if self.last_update < time.time() - (1.0 / self.MAX_UPDATES_PER_SEC):
+            services.download_status_manager.update_status( self.download_id, speed = self.speed, progress = self.progress)
+            self.last_update = time.time()
+        else:
+            log( 'Skipping GUI update.', sender = self)
 
         if self.cancelled:
             util.delete_file( self.tempname)
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel

Reply via email to