forked from friendica/friendica-addons
Replace the "Queue" mechanism with deferred workers
This commit is contained in:
parent
f226a42443
commit
d6578733be
|
@ -18,6 +18,7 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Queue;
|
use Friendica\Model\Queue;
|
||||||
|
use Friendica\Core\Worker;
|
||||||
|
|
||||||
function diaspora_install()
|
function diaspora_install()
|
||||||
{
|
{
|
||||||
|
@ -402,8 +403,8 @@ function diaspora_send(App $a, array &$b)
|
||||||
|
|
||||||
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
|
||||||
|
|
||||||
Queue::add($a->contact, Protocol::DIASPORA2, $s);
|
Worker::defer();
|
||||||
notice(L10n::t('Diaspora post failed. Queued for retry.').EOL);
|
notice(L10n::t('Diaspora post failed. Deferred for retry.').EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,8 +617,8 @@ function pumpio_send(App $a, array &$b)
|
||||||
|
|
||||||
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
|
||||||
|
|
||||||
Queue::add($a->contact, Protocol::PUMPIO, $s);
|
Worker::defer();
|
||||||
notice(L10n::t('Pump.io post failed. Queued for retry.').EOL);
|
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]);
|
$s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
|
||||||
|
|
||||||
Queue::add($a->contact, Protocol::PUMPIO, $s);
|
Worker::defer();
|
||||||
notice(L10n::t('Pump.io like failed. Queued for retry.').EOL);
|
notice(L10n::t('Pump.io like failed. Deferred for retry.').EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -692,8 +692,8 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
|
|
||||||
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
|
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
|
||||||
|
|
||||||
Queue::add($a->contact, Protocol::TWITTER, $s);
|
Worker::defer();
|
||||||
notice(L10n::t('Twitter post failed. Queued for retry.') . EOL);
|
notice(L10n::t('Twitter post failed. Deferred for retry.') . EOL);
|
||||||
} elseif ($iscomment) {
|
} elseif ($iscomment) {
|
||||||
Logger::log('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
|
Logger::log('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
|
||||||
Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]);
|
Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]);
|
||||||
|
|
Loading…
Reference in a new issue