You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There could be a flag on the Db class - or inside each of those methods - that would reduce the number of database reads.
Currently, each iteration over reserve() issues a SELECT. If there are 100 jobs waiting to be run, 200 queries will happen: 100 selecting and 100 deleting. Instead, one one SELECT query could be issued if the developer sets a given flag, and a pool of jobs would be held inside the Queue class for further processing.
Example:
$queue = newDbQueue();
$queue->bulkFetches = true;
$queue->put(1);
$queue->put(2);
$queue->put(3);
while ($job = $queue->reserve()) { //one query, three jobsecho$job->getBody();
$job->delete(); //one query per job; can't be avoided as further jobs may hang
}
A call to reserve(), peekReady(), peekBuried() or peekDelayed() would retrieve all available jobs given those constraints, store them in a cache (a class property for instance) and returns one every time the method is called again. Once that cache is emptied, a new query would happen.
The text was updated successfully, but these errors were encountered:
There could be a flag on the Db class - or inside each of those methods - that would reduce the number of database reads.
Currently, each iteration over reserve() issues a
SELECT
. If there are 100 jobs waiting to be run, 200 queries will happen: 100 selecting and 100 deleting. Instead, one oneSELECT
query could be issued if the developer sets a given flag, and a pool of jobs would be held inside the Queue class for further processing.Example:
A call to
reserve()
,peekReady()
,peekBuried()
orpeekDelayed()
would retrieve all available jobs given those constraints, store them in a cache (a class property for instance) and returns one every time the method is called again. Once that cache is emptied, a new query would happen.The text was updated successfully, but these errors were encountered: