Hi Ferran!
In data giovedì 28 febbraio 2013 15:51:01, Ferran Jorba ha scritto:
> Hello Tibor,
>
> > I'll try to follow the if-then-else logic to see why it does not obey
> > the CFG_BIBSCHED_REFRESHTIME value or maybe there is an exception that
> > causes the logic to miss the time.sleep function.
>
> Found! The attached trivial patch fixes it. I don't fully understand
> the old reason to put the time.sleep() in a else loop clause; maybe it
> was an overoptimization. I think that it is easier to understand now.
there is a reason for that "else": in that loop we check if the status of any
task has been changed since the last iteration (e.g. task put to sleep, task
woken up, task priority updated, etc.). If no change happened, good. we can
sleep 5 seconds and wait for some task to change. If, however, at least a
change happened, we should quickly re-read the task table, in order to take a
further decision.
With your patch a refreshed view of the system and a task scheduling decision
would be taken once every 5 seconds, no matter what. This could introduce
unnecessary delays especially in the case of a system having many record
updates.
With the current situation you would have most of the time a check happening
every 5 seconds, interleaved by few bursts of CPU consumption in case a task
is finally executed, or terminates, etc.
Cheers!
Sam
--
Samuele Kaplun
Invenio Developer ** <http://invenio-software.org/>