]> git.mxchange.org Git - friendica.git/commitdiff
Dynamic priority handling
authorMichael <heluecht@pirati.ca>
Thu, 17 May 2018 23:43:44 +0000 (23:43 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 17 May 2018 23:43:44 +0000 (23:43 +0000)
src/Model/PushSubscriber.php
src/Worker/Queue.php

index 2794a0b6121c73ee29cf5350a822eb4b582e62fd..e982c1444232945f79096cab905d2721dc9c4c9b 100644 (file)
@@ -18,10 +18,14 @@ class PushSubscriber
        {
                // We'll push to each subscriber that has push > 0,
                // i.e. there has been an update (set in notifier.php).
-               $subscribers = dba::select('push_subscriber', ['id', 'callback_url'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
+               $subscribers = dba::select('push_subscriber', ['id', 'push', 'callback_url'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
 
                while ($subscriber = dba::fetch($subscribers)) {
-                       logger("Publish feed to " . $subscriber["callback_url"], LOGGER_DEBUG);
+                       // We always handle retries with low priority
+                       if ($subscriber["push"] > 1) {
+                               $priority = PRIORITY_LOW;
+                       }
+                       logger("Publish feed to " . $subscriber["callback_url"] . " with priority " . $priority, LOGGER_DEBUG);
                        Worker::add($priority, 'PubSubPublish', (int)$subscriber["id"]);
                }
 
index 50a9a5c91acb7c9dbc52c928bf9ea0eb9b554536..256227fb62456c09420ef6799a73f960bbb19ec6 100644 (file)
@@ -35,7 +35,7 @@ class Queue
                        logger('filling queue jobs - start');
 
                        // Handling the pubsubhubbub requests
-                       PushSubscriber::publishFeed(PRIORITY_LOW);
+                       PushSubscriber::publishFeed();
 
                        $r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));