It's faster without locks, gnarl ...
This commit is contained in:
+1
-10
@@ -88,6 +88,7 @@ function poller_run($argv, $argc){
|
||||
// If we got that queue entry we claim it for us
|
||||
if (!poller_claim_process($r[0])) {
|
||||
Lock::remove('poller_fetch_worker');
|
||||
usleep(rand(0, 200000));
|
||||
continue;
|
||||
} else {
|
||||
// Fetch all workerqueue data while the table is still locked
|
||||
@@ -95,7 +96,6 @@ function poller_run($argv, $argc){
|
||||
$entries = poller_total_entries();
|
||||
$top_priority = poller_highest_priority();
|
||||
$high_running = poller_process_with_priority_active($top_priority);
|
||||
Lock::remove('poller_fetch_worker');
|
||||
}
|
||||
|
||||
// To avoid the quitting of multiple pollers only one poller at a time will execute the check
|
||||
@@ -616,10 +616,6 @@ function poller_worker_process() {
|
||||
// Check if we should pass some low priority process
|
||||
$highest_priority = 0;
|
||||
|
||||
if (!Lock::set('poller_fetch_worker')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (poller_passing_slow($highest_priority)) {
|
||||
// Are there waiting processes with a higher priority than the currently highest?
|
||||
$r = q("SELECT * FROM `workerqueue`
|
||||
@@ -647,11 +643,6 @@ function poller_worker_process() {
|
||||
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
|
||||
}
|
||||
|
||||
// We only unlock the tables here, when we got no data
|
||||
if (!dbm::is_result($r)) {
|
||||
Lock::remove('poller_fetch_worker');
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user