OStatus plugin: Rolling batch queueing for PuSH output to >50 subscribing sites. Keeps latency down for other things enqueued while we work...

This commit is contained in:
Brion Vibber
2010-06-04 11:48:54 -07:00
parent 8b9436e8ae
commit 41e9dba729
3 changed files with 52 additions and 1 deletions

View File

@@ -304,6 +304,26 @@ class HubSub extends Memcached_DataObject
$qm->enqueue($data, 'hubout');
}
/**
* Queue up a large batch of pushes to multiple subscribers
* for this same topic update.
*
* If queues are disabled, this will run immediately.
*
* @param string $atom well-formed Atom feed
* @param array $pushCallbacks list of callback URLs
*/
function bulkDistribute($atom, $pushCallbacks)
{
$data = array('atom' => $atom,
'topic' => $this->topic,
'pushCallbacks' => $pushCallbacks);
common_log(LOG_INFO, "Queuing PuSH batch: $this->topic to " .
count($pushCallbacks) . " sites");
$qm = QueueManager::get();
$qm->enqueue($data, 'hubprep');
}
/**
* Send a 'fat ping' to the subscriber's callback endpoint
* containing the given Atom feed chunk.