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;
|
||||
case 'TwitterOAuthClient':
|
||||
case 'TwitterQueueHandler':
|
||||
case 'TweetInQueueHandler':
|
||||
case 'TwitterImport':
|
||||
case 'JsonStreamReader':
|
||||
case 'TwitterStreamReader':
|
||||
|
@ -196,26 +196,18 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
||||
' - Retrieved ' . sizeof($timeline) . ' statuses from ' . $timelineUri . ' timeline' .
|
||||
' - for user ' . $flink->user_id);
|
||||
|
||||
/* @fixme make TwitterBridge use queueing system
|
||||
* to speed up timeline processing
|
||||
* as well as giving oportunity to use
|
||||
* usefull feature such as realtime
|
||||
* brodcast to clients
|
||||
*/
|
||||
$importer = new TwitterImport();
|
||||
|
||||
// Reverse to preserve order
|
||||
|
||||
foreach (array_reverse($timeline) as $status) {
|
||||
$notice = $importer->importStatus($status);
|
||||
|
||||
if (!empty($notice)) {
|
||||
Inbox::insertNotice($flink->user_id, $notice->id);
|
||||
}
|
||||
}
|
||||
/* @fixme ends here */
|
||||
|
||||
if (!empty($timeline)) {
|
||||
$qm = QueueManager::get();
|
||||
|
||||
// Reverse to preserve order
|
||||
foreach (array_reverse($timeline) as $status) {
|
||||
$data = array(
|
||||
'status' => $status,
|
||||
'for_user' => $flink->foreign_id,
|
||||
);
|
||||
$qm->enqueue($data, 'tweetin');
|
||||
}
|
||||
|
||||
$lastId = twitter_id($timeline[0]);
|
||||
Twitter_synch_status::setLastId($flink->foreign_id, $timelineUri, $lastId);
|
||||
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();
|
||||
$notice = $importer->importStatus($status);
|
||||
if ($notice) {
|
||||
$flink = Foreign_link::getByForeignID(TWITTER_SERVICE, $receiver);
|
||||
$flink = Foreign_link::getByForeignID($receiver, TWITTER_SERVICE);
|
||||
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?
|
||||
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