bulkDistribute won't add empty lists to database

This commit is contained in:
Mikael Nordfeldth 2016-01-16 17:34:27 +01:00
parent f53ebdeadb
commit c559b8ce2a

View File

@ -251,12 +251,17 @@ class HubSub extends Managed_DataObject
*/ */
function bulkDistribute($atom, array $pushCallbacks) function bulkDistribute($atom, array $pushCallbacks)
{ {
if (empty($pushCallbacks)) {
common_log(LOG_ERR, 'Callback list empty for bulkDistribute.');
return false;
}
$data = array('atom' => $atom, $data = array('atom' => $atom,
'topic' => $this->getTopic(), 'topic' => $this->getTopic(),
'pushCallbacks' => $pushCallbacks); 'pushCallbacks' => $pushCallbacks);
common_log(LOG_INFO, "Queuing PuSH batch: {$this->getTopic()} to ".count($pushCallbacks)." sites"); common_log(LOG_INFO, "Queuing PuSH batch: {$this->getTopic()} to ".count($pushCallbacks)." sites");
$qm = QueueManager::get(); $qm = QueueManager::get();
$qm->enqueue($data, 'hubprep'); $qm->enqueue($data, 'hubprep');
return true;
} }
/** /**