summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-21 21:39:50 -0500
committerEvan Prodromou <evan@status.net>2010-02-21 21:39:50 -0500
commit273c0e036347891570a02502715345f5bbb7b143 (patch)
tree489c1a254e4698443e30032b0a37226259b9c958 /plugins/OStatus/lib
parent912814fb7f3580e6925b5fae7092966df9bf3aab (diff)
parentca2a88545d353f0e887f48fe0e3bd43b505031ca (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'plugins/OStatus/lib')
-rw-r--r--plugins/OStatus/lib/hubdistribqueuehandler.php5
-rw-r--r--plugins/OStatus/lib/huboutqueuehandler.php18
2 files changed, 14 insertions, 9 deletions
diff --git a/plugins/OStatus/lib/hubdistribqueuehandler.php b/plugins/OStatus/lib/hubdistribqueuehandler.php
index 245a57f72..30a427e3f 100644
--- a/plugins/OStatus/lib/hubdistribqueuehandler.php
+++ b/plugins/OStatus/lib/hubdistribqueuehandler.php
@@ -124,10 +124,7 @@ class HubDistribQueueHandler extends QueueHandler
common_log(LOG_INFO, "Preparing $sub->N PuSH distribution(s) for $sub->topic");
$qm = QueueManager::get();
while ($sub->fetch()) {
- common_log(LOG_INFO, "Prepping PuSH distribution to $sub->callback for $sub->topic");
- $data = array('sub' => clone($sub),
- 'atom' => $atom);
- $qm->enqueue($data, 'hubout');
+ $sub->distribute($atom);
}
}
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;
}
}
-