3 * @file src/Model/PushSubscriber.php
5 namespace Friendica\Model;
7 use Friendica\Core\Worker;
10 require_once 'include/dba.php';
15 * @param string $priority Priority for push workers
17 public static function publishFeed($priority = PRIORITY_HIGH)
19 // We'll push to each subscriber that has push > 0,
20 // i.e. there has been an update (set in notifier.php).
21 $subscribers = dba::select('push_subscriber', ['id', 'push', 'callback_url'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
23 while ($subscriber = dba::fetch($subscribers)) {
24 // We always handle retries with low priority
25 if ($subscriber["push"] > 1) {
26 $priority = PRIORITY_LOW;
28 logger("Publish feed to " . $subscriber["callback_url"] . " with priority " . $priority, LOGGER_DEBUG);
29 Worker::add($priority, 'PubSubPublish', (int)$subscriber["id"]);
32 dba::close($subscribers);