Merge pull request #4744 from annando/queue-improvements
Queue: Better handling of return values of transmissionspull/4745/head
commit
31cae67614
|
@ -313,7 +313,7 @@ class Delivery {
|
||||||
if (!Queue::wasDelayed($contact['id'])) {
|
if (!Queue::wasDelayed($contact['id'])) {
|
||||||
$deliver_status = DFRN::deliver($owner, $contact, $atom);
|
$deliver_status = DFRN::deliver($owner, $contact, $atom);
|
||||||
} else {
|
} else {
|
||||||
$deliver_status = (-1);
|
$deliver_status = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('notifier: dfrn_delivery to '.$contact["url"].' with guid '.$target_item["guid"].' returns '.$deliver_status);
|
logger('notifier: dfrn_delivery to '.$contact["url"].' with guid '.$target_item["guid"].' returns '.$deliver_status);
|
||||||
|
@ -323,12 +323,12 @@ class Delivery {
|
||||||
Queue::add($contact['id'], NETWORK_DFRN, $atom, false, $target_item['guid']);
|
Queue::add($contact['id'], NETWORK_DFRN, $atom, false, $target_item['guid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($deliver_status < 200) {
|
if (($deliver_status >= 200) && ($deliver_status <= 299)) {
|
||||||
// The message could not be delivered. We mark the contact as "dead"
|
|
||||||
Contact::markForArchival($contact);
|
|
||||||
} else {
|
|
||||||
// We successfully delivered a message, the contact is alive
|
// We successfully delivered a message, the contact is alive
|
||||||
Contact::unmarkForArchival($contact);
|
Contact::unmarkForArchival($contact);
|
||||||
|
} else {
|
||||||
|
// The message could not be delivered. We mark the contact as "dead"
|
||||||
|
Contact::markForArchival($contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -63,6 +63,11 @@ class Queue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($contact['notify'])) {
|
||||||
|
QueueModel::removeItem($q_item['id']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$dead = Cache::get($cachekey_deadguy . $contact['notify']);
|
$dead = Cache::get($cachekey_deadguy . $contact['notify']);
|
||||||
|
|
||||||
if (!is_null($dead) && $dead && !$no_dead_check) {
|
if (!is_null($dead) && $dead && !$no_dead_check) {
|
||||||
|
@ -109,37 +114,33 @@ class Queue
|
||||||
logger('queue: dfrndelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
logger('queue: dfrndelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
||||||
$deliver_status = DFRN::deliver($owner, $contact, $data);
|
$deliver_status = DFRN::deliver($owner, $contact, $data);
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
if (($deliver_status >= 200) && ($deliver_status <= 299)) {
|
||||||
|
QueueModel::removeItem($q_item['id']);
|
||||||
|
} else {
|
||||||
|
QueueModel::updateTime($q_item['id']);
|
||||||
|
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NETWORK_OSTATUS:
|
||||||
|
logger('queue: slapdelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
||||||
|
$deliver_status = Salmon::slapper($owner, $contact['notify'], $data);
|
||||||
|
|
||||||
|
if ($deliver_status == -1) {
|
||||||
QueueModel::updateTime($q_item['id']);
|
QueueModel::updateTime($q_item['id']);
|
||||||
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
} else {
|
} else {
|
||||||
QueueModel::removeItem($q_item['id']);
|
QueueModel::removeItem($q_item['id']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NETWORK_OSTATUS:
|
|
||||||
if ($contact['notify']) {
|
|
||||||
logger('queue: slapdelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
|
||||||
$deliver_status = Salmon::slapper($owner, $contact['notify'], $data);
|
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
|
||||||
QueueModel::updateTime($q_item['id']);
|
|
||||||
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
|
||||||
} else {
|
|
||||||
QueueModel::removeItem($q_item['id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NETWORK_DIASPORA:
|
case NETWORK_DIASPORA:
|
||||||
if ($contact['notify']) {
|
logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
||||||
logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
$deliver_status = Diaspora::transmit($owner, $contact, $data, $public, true, 'Queue:' . $q_item['id'], true);
|
||||||
$deliver_status = Diaspora::transmit($owner, $contact, $data, $public, true, 'Queue:' . $q_item['id'], true);
|
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
if (($deliver_status >= 200) && ($deliver_status <= 299)) {
|
||||||
QueueModel::updateTime($q_item['id']);
|
QueueModel::removeItem($q_item['id']);
|
||||||
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
} else {
|
||||||
} else {
|
QueueModel::updateTime($q_item['id']);
|
||||||
QueueModel::removeItem($q_item['id']);
|
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ class Queue
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger('Deliver status ' . (int) $deliver_status . ' for item ' . $q_item['id'] . ' to ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
logger('Deliver status ' . (int)$deliver_status . ' for item ' . $q_item['id'] . ' to ' . $contact['name'] . ' <' . $contact['url'] . '>');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue