summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib/huboutqueuehandler.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-21 14:28:06 -0800
committerBrion Vibber <brion@pobox.com>2010-02-21 14:28:06 -0800
commitaa0b2ce81ad4a99fb55a36feda54e70bcd0808be (patch)
treea717518d378806729d40e6032e83eb2499d94a73 /plugins/OStatus/lib/huboutqueuehandler.php
parent37179a91d5e176a743453cf27de606553bd62f36 (diff)
OStatus PuSH fixlets:
- set minimal error page output on PuSH callback - allow hub to retry ($config['ostatus']['hub_retries']), simplify internal iface a bit. Retries are pushed to end of queue but otherwise not delayed yet; makes delivery more robust to one-off transitory errors but not yet against downtime.
Diffstat (limited to 'plugins/OStatus/lib/huboutqueuehandler.php')
-rw-r--r--plugins/OStatus/lib/huboutqueuehandler.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/OStatus/lib/huboutqueuehandler.php b/plugins/OStatus/lib/huboutqueuehandler.php
index 0791c7e5d..3ad94646e 100644
--- a/plugins/OStatus/lib/huboutqueuehandler.php
+++ b/plugins/OStatus/lib/huboutqueuehandler.php
@@ -33,6 +33,7 @@ class HubOutQueueHandler extends QueueHandler
{
$sub = $data['sub'];
$atom = $data['atom'];
+ $retries = $data['retries'];
assert($sub instanceof HubSub);
assert(is_string($atom));
@@ -40,13 +41,20 @@ class HubOutQueueHandler extends QueueHandler
try {
$sub->push($atom);
} catch (Exception $e) {
- common_log(LOG_ERR, "Failed PuSH to $sub->callback for $sub->topic: " .
- $e->getMessage());
- // @fixme Reschedule a later delivery?
- return true;
+ $retries--;
+ $msg = "Failed PuSH to $sub->callback for $sub->topic: " .
+ $e->getMessage();
+ if ($retries > 0) {
+ common_log(LOG_ERR, "$msg; scheduling for $retries more tries");
+
+ // @fixme when we have infrastructure to schedule a retry
+ // after a delay, use it.
+ $sub->distribute($atom, $retries);
+ } else {
+ common_log(LOG_ERR, "$msg; discarding");
+ }
}
return true;
}
}
-