diff options
author | Evan Prodromou <evan@status.net> | 2010-09-07 04:22:55 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-09-07 04:22:55 -0400 |
commit | e53e152d6f2b310d7206b640cb3840ec5531aa86 (patch) | |
tree | d5fc575f62ff3a2ee93163a26bf87ccae5ccc185 /plugins/TwitterBridge | |
parent | 86b6d7b722e99c409b966dd7d7ea4807bac070c6 (diff) |
use and save since_id parameter for home_timeline
Diffstat (limited to 'plugins/TwitterBridge')
-rwxr-xr-x | plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index e092cd1dd..7c80d2e5d 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -103,7 +103,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon function getObjects() { global $_DB_DATAOBJECT; - $flink = new Foreign_link(); $conn = &$flink->getDatabaseConnection(); @@ -183,8 +182,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon $timeline = null; + $lastId = Twitter_synch_status::getLastId($flink->user_id, 'home_timeline'); + try { - $timeline = $client->statusesHomeTimeline(); + $timeline = $client->statusesHomeTimeline($lastId); } catch (Exception $e) { common_log(LOG_WARNING, $this->name() . ' - Twitter client unable to get friends timeline for user ' . @@ -199,10 +200,14 @@ class TwitterStatusFetcher extends ParallelizingDaemon common_debug(LOG_INFO, $this->name() . ' - Retrieved ' . sizeof($timeline) . ' statuses from Twitter.'); + $lastSeenId = null; + // Reverse to preserve order foreach (array_reverse($timeline) as $status) { + $lastSeenId = $status->id; + // Hacktastic: filter out stuff coming from this StatusNet $source = mb_strtolower(common_config('integration', 'source')); @@ -227,6 +232,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon } } + if (!empty($lastSeenId)) { + Twitter_synch_status::setLastId($flink->user_id, 'home_timeline', $lastSeenId); + } + // Okay, record the time we synced with Twitter for posterity $flink->last_noticesync = common_sql_now(); |