DataEngine and regular polling.

Thomas Fjellstrom tfjellstrom at shaw.ca
Wed Jul 14 19:36:09 CEST 2010


On July 14, 2010, Aaron J. Seigo wrote:
> On July 13, 2010, Thomas Fjellstrom wrote:
> > To explain, the data engine will do a DNS lookup, arp lookup, and a
> > shell out to ping (that runs for about 5 seconds per host), when an
> > update is requested. The data engine can not wait for them to finish,
> > otherwise it'd block for possibly (if DNS is having issues) tens of
> > seconds at a time, per host.
> > 
> > So what should I do here?
> 
> if a timeout is requested, but no data can be filled immediately, then
> once setData is called on the source, at that point the visualization
> should be notified.
> 
> in your case, it sounds like there are multiple setData calls, however.
> so the first one probably triggers an update, and the subsequent ones
> (e.g. the ping) waits for the next timeout.

Yeah, the regular update will set off the dns check, and the much longer 
running ping call. each will be spaced several seconds apart.

> one way around that is to not use the setData API in DataEngine, but to
> instead create subclasses of DataContainer for each sourc. when all the
> data is retreived, then the DataContainer can call checkForUpdate().
> that should work better for your use case.

Hmm, so after I receive the updates from QHostInfo/QProcess, I should call 
checkForUpdate in my new custom DataContainer?

> > > > 2. DataEngine::setPollingInterval seems to poll only once.
> > > 
> > > yes, that's an engine-wide polling interval.
> > 
> > I mean once period. I expected it to actually setup a regular poll, not
> > a one shot timer.
> 
> that was a bug; i've just fixed it. it now does set up a regular poll as
> it is supposed to :)

Will the fix make it into 4.5?

Temporarily I've added a regular timer to my data engine that calls a 
function that just loops over my internal list of found hosts, and calls 
their update method, which sets off the long running DNS/ping checks.

-- 
Thomas Fjellstrom
tfjellstrom at shaw.ca


More information about the Plasma-devel mailing list