|
@@ -247,7 +247,7 @@ class default_1 {
|
|
const offset = lock.threads[currentFeed].offset;
|
|
const offset = lock.threads[currentFeed].offset;
|
|
if (offset > 0)
|
|
if (offset > 0)
|
|
config.since_id = offset;
|
|
config.since_id = offset;
|
|
- this.client.get(endpoint, config, (error, tweets, response) => {
|
|
|
|
|
|
+ const getMore = (gotTweets = []) => this.client.get(endpoint, config, (error, tweets) => {
|
|
if (error) {
|
|
if (error) {
|
|
if (error instanceof Array && error.length > 0 && error[0].code === 34) {
|
|
if (error instanceof Array && error.length > 0 && error[0].code === 34) {
|
|
logger.warn(`error on fetching tweets for ${currentFeed}: ${JSON.stringify(error)}`);
|
|
logger.warn(`error on fetching tweets for ${currentFeed}: ${JSON.stringify(error)}`);
|
|
@@ -259,11 +259,13 @@ class default_1 {
|
|
else {
|
|
else {
|
|
logger.error(`unhandled error on fetching tweets for ${currentFeed}: ${JSON.stringify(error)}`);
|
|
logger.error(`unhandled error on fetching tweets for ${currentFeed}: ${JSON.stringify(error)}`);
|
|
}
|
|
}
|
|
- resolve([]);
|
|
|
|
}
|
|
}
|
|
- else
|
|
|
|
- resolve(tweets);
|
|
|
|
|
|
+ if (!tweets || tweets.length <= 1)
|
|
|
|
+ return resolve(gotTweets);
|
|
|
|
+ config.max_id = tweets.slice(-1)[0].id_str;
|
|
|
|
+ getMore(gotTweets.concat(tweets));
|
|
});
|
|
});
|
|
|
|
+ getMore();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
promise.then((tweets) => {
|
|
promise.then((tweets) => {
|