forked from GNUsocial/gnu-social
Make TwitterBridge plugin use Queueing system
This commit is contained in:
parent
dd97468c72
commit
a10a34a3cf
@ -204,6 +204,7 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
return false;
|
return false;
|
||||||
case 'TwitterOAuthClient':
|
case 'TwitterOAuthClient':
|
||||||
case 'TwitterQueueHandler':
|
case 'TwitterQueueHandler':
|
||||||
|
case 'TweetInQueueHandler':
|
||||||
case 'TwitterImport':
|
case 'TwitterImport':
|
||||||
case 'JsonStreamReader':
|
case 'JsonStreamReader':
|
||||||
case 'TwitterStreamReader':
|
case 'TwitterStreamReader':
|
||||||
|
@ -196,26 +196,18 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
' - Retrieved ' . sizeof($timeline) . ' statuses from ' . $timelineUri . ' timeline' .
|
' - Retrieved ' . sizeof($timeline) . ' statuses from ' . $timelineUri . ' timeline' .
|
||||||
' - for user ' . $flink->user_id);
|
' - for user ' . $flink->user_id);
|
||||||
|
|
||||||
/* @fixme make TwitterBridge use queueing system
|
if (!empty($timeline)) {
|
||||||
* to speed up timeline processing
|
$qm = QueueManager::get();
|
||||||
* as well as giving oportunity to use
|
|
||||||
* usefull feature such as realtime
|
|
||||||
* brodcast to clients
|
|
||||||
*/
|
|
||||||
$importer = new TwitterImport();
|
|
||||||
|
|
||||||
// Reverse to preserve order
|
// Reverse to preserve order
|
||||||
|
|
||||||
foreach (array_reverse($timeline) as $status) {
|
foreach (array_reverse($timeline) as $status) {
|
||||||
$notice = $importer->importStatus($status);
|
$data = array(
|
||||||
|
'status' => $status,
|
||||||
if (!empty($notice)) {
|
'for_user' => $flink->foreign_id,
|
||||||
Inbox::insertNotice($flink->user_id, $notice->id);
|
);
|
||||||
|
$qm->enqueue($data, 'tweetin');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* @fixme ends here */
|
|
||||||
|
|
||||||
if (!empty($timeline)) {
|
|
||||||
$lastId = twitter_id($timeline[0]);
|
$lastId = twitter_id($timeline[0]);
|
||||||
Twitter_synch_status::setLastId($flink->foreign_id, $timelineUri, $lastId);
|
Twitter_synch_status::setLastId($flink->foreign_id, $timelineUri, $lastId);
|
||||||
common_debug("Set lastId value '$lastId' for foreign id '{$flink->foreign_id}' and timeline '" .
|
common_debug("Set lastId value '$lastId' for foreign id '{$flink->foreign_id}' and timeline '" .
|
||||||
|
@ -51,10 +51,14 @@ class TweetInQueueHandler extends QueueHandler
|
|||||||
$importer = new TwitterImport();
|
$importer = new TwitterImport();
|
||||||
$notice = $importer->importStatus($status);
|
$notice = $importer->importStatus($status);
|
||||||
if ($notice) {
|
if ($notice) {
|
||||||
$flink = Foreign_link::getByForeignID(TWITTER_SERVICE, $receiver);
|
$flink = Foreign_link::getByForeignID($receiver, TWITTER_SERVICE);
|
||||||
if ($flink) {
|
if ($flink) {
|
||||||
|
common_log(LOG_DEBUG, "TweetInQueueHandler - Got flink so add notice ".
|
||||||
|
$notice->id." to inbox ".$flink->user_id);
|
||||||
// @fixme this should go through more regular channels?
|
// @fixme this should go through more regular channels?
|
||||||
Inbox::insertNotice($flink->user_id, $notice->id);
|
Inbox::insertNotice($flink->user_id, $notice->id);
|
||||||
|
}else {
|
||||||
|
common_log(LOG_DEBUG, "TweetInQueueHandler - No flink found for foreign user ".$receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user