forked from GNUsocial/gnu-social
debug statements for setting/getting last id
This commit is contained in:
parent
9793e4ceb4
commit
d37f0da077
@ -166,10 +166,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
common_debug($this->name() . ' - Trying to get timeline for Twitter user ' .
|
common_debug($this->name() . ' - Trying to get timeline for Twitter user ' .
|
||||||
$flink->foreign_id);
|
$flink->foreign_id);
|
||||||
|
|
||||||
// XXX: Biggest remaining issue - How do we know at which status
|
|
||||||
// to start importing? How many statuses? Right now I'm going
|
|
||||||
// with the default last 20.
|
|
||||||
|
|
||||||
$client = null;
|
$client = null;
|
||||||
|
|
||||||
if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
|
if (TwitterOAuthClient::isPackedToken($flink->credentials)) {
|
||||||
@ -184,6 +180,8 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
|
|
||||||
$lastId = Twitter_synch_status::getLastId($flink->foreign_id, 'home_timeline');
|
$lastId = Twitter_synch_status::getLastId($flink->foreign_id, 'home_timeline');
|
||||||
|
|
||||||
|
common_debug("Got lastId value '{$lastId}' for foreign id '{$flink->foreign_id}' and timeline 'home_timeline'");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$timeline = $client->statusesHomeTimeline($lastId);
|
$timeline = $client->statusesHomeTimeline($lastId);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -204,8 +202,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
|
|
||||||
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'));
|
||||||
@ -230,11 +226,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!empty($timeline)); // checked above
|
if (!empty($timeline)) {
|
||||||
|
|
||||||
// First status is last in time
|
|
||||||
|
|
||||||
Twitter_synch_status::setLastId($flink->foreign_id, 'home_timeline', $timeline[0]->id);
|
Twitter_synch_status::setLastId($flink->foreign_id, 'home_timeline', $timeline[0]->id);
|
||||||
|
common_debug("Set lastId value '{$timeline[0]->id}' for foreign id '{$flink->foreign_id}' and timeline 'home_timeline'");
|
||||||
|
}
|
||||||
|
|
||||||
// Okay, record the time we synced with Twitter for posterity
|
// Okay, record the time we synced with Twitter for posterity
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user