]> git.mxchange.org Git - friendica-addons.git/commitdiff
Replace the "Queue" mechanism with deferred workers
authorMichael <heluecht@pirati.ca>
Thu, 4 Apr 2019 14:14:55 +0000 (14:14 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 4 Apr 2019 14:14:55 +0000 (14:14 +0000)
diaspora/diaspora.php
pumpio/pumpio.php
twitter/twitter.php

index 88630fe0adec6132eadb21302d76d83e2a7be56f..d8c634358243cad48fea176dfdb5c577af8fb832 100644 (file)
@@ -18,6 +18,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\Model\Queue;
+use Friendica\Core\Worker;
 
 function diaspora_install()
 {
@@ -402,8 +403,8 @@ function diaspora_send(App $a, array &$b)
 
                        $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
 
-                       Queue::add($a->contact, Protocol::DIASPORA2, $s);
-                       notice(L10n::t('Diaspora post failed. Queued for retry.').EOL);
+                       Worker::defer();
+                       notice(L10n::t('Diaspora post failed. Deferred for retry.').EOL);
                }
        }
 }
index 319c109ad7afd33f5b5bdb4417151430a50da4aa..b6716ebc635cc591d9bba81e99a76f43e51f1f7a 100644 (file)
@@ -617,8 +617,8 @@ function pumpio_send(App $a, array &$b)
 
                        $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
 
-                       Queue::add($a->contact, Protocol::PUMPIO, $s);
-                       notice(L10n::t('Pump.io post failed. Queued for retry.').EOL);
+                       Worker::defer();
+                       notice(L10n::t('Pump.io post failed. Deferred for retry.').EOL);
                }
        }
 }
@@ -694,8 +694,8 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
 
                $s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
 
-               Queue::add($a->contact, Protocol::PUMPIO, $s);
-               notice(L10n::t('Pump.io like failed. Queued for retry.').EOL);
+               Worker::defer();
+               notice(L10n::t('Pump.io like failed. Deferred for retry.').EOL);
        }
 }
 
index 2d331a7d69d6d24396f9f721d889f05a00dc3df1..74ebf5fdd069a63d61912bfdd3856e5c13cc7e08 100644 (file)
@@ -692,8 +692,8 @@ function twitter_post_hook(App $a, array &$b)
 
                        $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
 
-                       Queue::add($a->contact, Protocol::TWITTER, $s);
-                       notice(L10n::t('Twitter post failed. Queued for retry.') . EOL);
+                       Worker::defer();
+                       notice(L10n::t('Twitter post failed. Deferred for retry.') . EOL);
                } elseif ($iscomment) {
                        Logger::log('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
                        Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]);