Optimized priorities for the automated expiring of items
This commit is contained in:
parent
471056e989
commit
d7de7bb70a
|
@ -195,7 +195,7 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['priority'] AND !$force) {
|
if (($contact['priority'] >= 0) AND !$force) {
|
||||||
$update = false;
|
$update = false;
|
||||||
|
|
||||||
$t = $contact['last-update'];
|
$t = $contact['last-update'];
|
||||||
|
@ -225,11 +225,16 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
|
||||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
|
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 15 minute")) {
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2076,7 +2076,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
|
||||||
drop_item($item['id'], false);
|
drop_item($item['id'], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
|
proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2099,7 +2099,7 @@ function drop_items($items) {
|
||||||
// multiple threads may have been deleted, send an expire notification
|
// multiple threads may have been deleted, send an expire notification
|
||||||
|
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
|
proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2290,11 +2290,15 @@ function drop_item($id, $interactive = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$drop_id = intval($item['id']);
|
// send the notification upstream/downstream when it is one of our posts
|
||||||
|
// We don't have to do this for foreign posts
|
||||||
|
/// @todo Check if we still can delete foreign comments on our own post
|
||||||
|
if ($item['wall'] OR $item['origin']) {
|
||||||
|
$drop_id = intval($item['id']);
|
||||||
|
$priority = ($interactive ? PRIORITY_HIGH : PRIORITY_LOW);
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
proc_run($priority, "include/notifier.php", "drop", $drop_id);
|
||||||
|
}
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
|
||||||
|
|
||||||
if (! $interactive) {
|
if (! $interactive) {
|
||||||
return $owner;
|
return $owner;
|
||||||
|
|
|
@ -55,6 +55,17 @@ function notifier_run(&$argv, &$argc){
|
||||||
return;
|
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);
|
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
|
||||||
|
|
||||||
$cmd = $argv[1];
|
$cmd = $argv[1];
|
||||||
|
@ -348,7 +359,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
// a delivery fork. private groups (forum_mode == 2) do not uplink
|
// a delivery fork. private groups (forum_mode == 2) do not uplink
|
||||||
|
|
||||||
if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== '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();
|
$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);
|
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)) {
|
if ((! $mail) && (! $fsuggest) && (! $followup)) {
|
||||||
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
|
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
|
// Handling the pubsubhubbub requests
|
||||||
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
|
proc_run($priority, 'include/pubsubpublish.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('notifier: calling hooks', LOGGER_DEBUG);
|
logger('notifier: calling hooks', LOGGER_DEBUG);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user