Optimized priorities for the automated expiring of items

This commit is contained in:
Michael 2017-05-24 06:29:47 +00:00
parent 471056e989
commit d7de7bb70a
3 changed files with 32 additions and 12 deletions

View file

@ -55,6 +55,17 @@ function notifier_run(&$argv, &$argc){
return;
}
// Inherit the priority
$queue = dba::select('workerqueue', array('priority'), array('pid' => getmypid()), array('limit' => 1));
if (dbm::is_result($queue)) {
$priority = $queue['priority'];
logger('inherited priority: '.$priority);
} else {
// Normally this shouldn't happen.
$priority = PRIORITY_HIGH;
logger('no inherited priority! Something is wrong.');
}
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
$cmd = $argv[1];
@ -348,7 +359,7 @@ function notifier_run(&$argv, &$argc){
// a delivery fork. private groups (forum_mode == 2) do not uplink
if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
proc_run(PRIORITY_HIGH,'include/notifier.php','uplink',$item_id);
proc_run($priority, 'include/notifier.php', 'uplink', $item_id);
}
$conversants = array();
@ -487,7 +498,7 @@ function notifier_run(&$argv, &$argc){
}
logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
proc_run(PRIORITY_HIGH,'include/delivery.php', $cmd, $item_id, $contact['id']);
proc_run($priority, 'include/delivery.php', $cmd, $item_id, $contact['id']);
}
}
@ -552,7 +563,7 @@ function notifier_run(&$argv, &$argc){
if ((! $mail) && (! $fsuggest) && (! $followup)) {
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$rr['id']);
proc_run($priority, 'include/delivery.php', $cmd, $item_id, $rr['id']);
}
}
}
@ -592,7 +603,7 @@ function notifier_run(&$argv, &$argc){
}
// Handling the pubsubhubbub requests
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
proc_run($priority, 'include/pubsubpublish.php');
}
logger('notifier: calling hooks', LOGGER_DEBUG);