Bug 150389

Summary: Akregator doesn't do "idle". Storage backend wakes up every 3 seconds :-(.
Product: [Applications] akregator Reporter: Alan Jenkins <aj504>
Component: metakit pluginAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Fix storage backend polling
Improved patch using QTimer::singleShot()
Corrected version which takes feed storage changes into account

Description Alan Jenkins 2007-10-01 22:37:08 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Unspecified Linux
OS:                Linux

Idle computers sleep to save power.  Sucky applications wake up idle computers for no reason, wasting power.  This is the wisdom of powertop[1].

Since I prefer to use non sucky applications, heres a patch which removes the storage backends charming habit of waking up every 3 seconds to see whether there are changes to commit to disk.  I preserve the behaviour of batching commits over 3 second intervals, and of making sure changes are commited within 3 seconds.  

Disclaimer: I'm not a KDE dev; it looks good to me but it who knows if it'll eat your data.  

Taste-wise, maybe my new method should be "markModified()" for consistency, but "markDirty()" is clearer to me.  The commitTimer is now used as a single-shot, so maybe it should be ditched in favour of  QTimer::singleShot().

[1] www.linuxpowertop.org
Comment 1 Alan Jenkins 2007-10-01 22:45:46 UTC
Created attachment 21733 [details]
Fix storage backend polling

This can be tested by comparing powertop output before and after.  Before,
powertop should show ~0.4 wakeups/s on idle.  After, it should hardly show up
at all (when idle).

Note.  "idle" includes "not fetching feeds".  I.e. this wouldn't make a
difference if, like me, you had a dead feed that akregator keeps trying to
refetch.
Comment 2 Eckhart Wörner 2007-10-04 15:40:21 UTC
Created attachment 21751 [details]
Improved patch using QTimer::singleShot()

I changed your patch a bit, it now uses QTimer::singleShot() instead of an own
QTimer object, moves markDirty() to private section of the class. (Is there any
reason not to do so?)
Comment 3 Alan Jenkins 2007-10-04 16:00:51 UTC
Looks fine to me.  I was slightly puzzled by the lack of existing private methods so I put it next to slotCommit().  (Perhaps it's not usual to declare a slot as private?)

Thanks for looking at it!

P.S.  I wonder how many people would take it the wrong way if I said I'd posted a patch on the "akregator haxx0rz" website :-).
Comment 4 Eckhart Wörner 2007-10-06 02:23:39 UTC
Created attachment 21761 [details]
Corrected version which takes feed storage changes into account
Comment 5 Eckhart Wörner 2007-10-06 03:10:13 UTC
SVN commit 721755 by ewoerner:

Fix storage backend waking up CPU every 3 seconds, original patch by Alan Jenkins, bump version number
BUG: 150389

 M  +9 -1      ChangeLog  
 M  +1 -1      src/aboutdata.h  
 M  +31 -21    src/mk4storage/feedstoragemk4impl.cpp  
 M  +1 -0      src/mk4storage/feedstoragemk4impl.h  
 M  +17 -14    src/mk4storage/storagemk4impl.cpp  
 M  +2 -0      src/mk4storage/storagemk4impl.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=721755