Dataengnies

Aaron J. Seigo aseigo at kde.org
Tue Aug 26 22:38:47 CEST 2008


On Tuesday 26 August 2008, Petri Damstén wrote:
> That means that in my example updateSourceEvent is called twice at start
> when using the last method. This is bad especially when doing some async
> calls in updateSourceEvent. Of course there could be some extra code to
> prevent his, but is the updateSourceEvent call at start needed?

if it's a new source, no. if it isn't a new source, it likely will need an 
update. the problem comes when calling updateSourceEvent directly, in that 
case the update limiter code that uses minimumUpdateInterval is bypassed and 
so it becomes possible to update too quickly.

the easy, though i suppose shouldn't-be-necessary, way to protect against this 
in updateSourceEvent is to do:

if (source(name)->timeSinceLastUpdate() < (uint)mininimumPollingInterval()) {
     return;
}

but timSincLastUpdate is not public, but protected, so even that isn't a 
possibility.

*thinks* ok.. i've just committed something that should address this issue.


and yes, if the engine is doing any sort of expensive work then the code needs 
to protect against it being called while the async job is in progreess.

doing async calls inside the DataEngine subclas itself is really not the best 
way to do things. encapsulating it inside a DataContainer subclass makes it 
waaaay easier to manage.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080826/d00eafdb/attachment.sig 


More information about the Plasma-devel mailing list