Jobs execute in order of functions added, then priority
Bug #1067503 reported by
Doug Harple
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gearman |
Confirmed
|
Undecided
|
Brian Aker |
Bug Description
When determining which job to run next, it appears that the worker does the following:
1) Iterates over functions in the order in which they were added.
2) For each function, it pulls the highest priority available job, in the order that the job was added.
This behavior confused me at first, and led me to believe that the prioritization system was broken.
The behavior I expected was that it would pull the highest priority job from the set of functions added to the worker.
(If this is working as designed, that's OK, I can work around it. I couldn't find anything in the documentation regarding the behavior.)
To post a comment you must log in.
For example, I have a single worker that listens for functions a() and b():
$worker = new GermanWorker(); >addServer( ); >addFunction( 'a', 'a'); >addFunction( 'b', 'b');
$worker-
$worker-
$worker-
while ($worker->work());
I stop the worker, and I then run a client that does the following:
$client = new GearmanClient(); >addServer( ); >doHighBackgrou nd('b', 'whatever'); >doLowBackgroun d('a', 'whatever');
$client-
$client-
$client-
If I then start the worker, it will run the low priority task before the high priority task, due to the order in which the functions were added to the worker.