use and save since_id parameter for home_timeline
This commit is contained in:
parent
86b6d7b722
commit
e53e152d6f
@ -103,7 +103,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
function getObjects()
|
function getObjects()
|
||||||
{
|
{
|
||||||
global $_DB_DATAOBJECT;
|
global $_DB_DATAOBJECT;
|
||||||
|
|
||||||
$flink = new Foreign_link();
|
$flink = new Foreign_link();
|
||||||
$conn = &$flink->getDatabaseConnection();
|
$conn = &$flink->getDatabaseConnection();
|
||||||
|
|
||||||
@ -183,8 +182,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
|
|
||||||
$timeline = null;
|
$timeline = null;
|
||||||
|
|
||||||
|
$lastId = Twitter_synch_status::getLastId($flink->user_id, 'home_timeline');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$timeline = $client->statusesHomeTimeline();
|
$timeline = $client->statusesHomeTimeline($lastId);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_WARNING, $this->name() .
|
common_log(LOG_WARNING, $this->name() .
|
||||||
' - Twitter client unable to get friends timeline for user ' .
|
' - 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.');
|
common_debug(LOG_INFO, $this->name() . ' - Retrieved ' . sizeof($timeline) . ' statuses from Twitter.');
|
||||||
|
|
||||||
|
$lastSeenId = null;
|
||||||
|
|
||||||
// Reverse to preserve order
|
// Reverse to preserve order
|
||||||
|
|
||||||
foreach (array_reverse($timeline) as $status) {
|
foreach (array_reverse($timeline) as $status) {
|
||||||
|
|
||||||
|
$lastSeenId = $status->id;
|
||||||
|
|
||||||
// Hacktastic: filter out stuff coming from this StatusNet
|
// Hacktastic: filter out stuff coming from this StatusNet
|
||||||
|
|
||||||
$source = mb_strtolower(common_config('integration', 'source'));
|
$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
|
// Okay, record the time we synced with Twitter for posterity
|
||||||
|
|
||||||
$flink->last_noticesync = common_sql_now();
|
$flink->last_noticesync = common_sql_now();
|
||||||
|
Loading…
Reference in New Issue
Block a user