Locking seems to be better here
This commit is contained in:
parent
58880ca518
commit
2372ef7fd5
4
boot.php
4
boot.php
|
@ -1089,6 +1089,8 @@ function proc_run($cmd) {
|
||||||
$argv = $args;
|
$argv = $args;
|
||||||
array_shift($argv);
|
array_shift($argv);
|
||||||
|
|
||||||
|
dba::lock('workerqueue');
|
||||||
|
|
||||||
$parameters = json_encode($argv);
|
$parameters = json_encode($argv);
|
||||||
$found = dba::select('workerqueue', array('id'), array('parameter' => $parameters), array('limit' => 1));
|
$found = dba::select('workerqueue', array('id'), array('parameter' => $parameters), array('limit' => 1));
|
||||||
|
|
||||||
|
@ -1096,6 +1098,8 @@ function proc_run($cmd) {
|
||||||
dba::insert('workerqueue', array('parameter' => $parameters, 'created' => $created, 'priority' => $priority));
|
dba::insert('workerqueue', array('parameter' => $parameters, 'created' => $created, 'priority' => $priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dba::unlock();
|
||||||
|
|
||||||
// Should we quit and wait for the poller to be called as a cronjob?
|
// Should we quit and wait for the poller to be called as a cronjob?
|
||||||
if ($dont_fork) {
|
if ($dont_fork) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,6 +20,7 @@ function pubsubpublish_run(&$argv, &$argc){
|
||||||
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
|
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
|
||||||
proc_run(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
|
proc_run(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
|
||||||
'include/pubsubpublish.php', (int)$rr["id"]);
|
'include/pubsubpublish.php', (int)$rr["id"]);
|
||||||
|
logger("Publish feed to ".$rr["callback_url"].' - done', LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user