Skip to content

Commit

Permalink
src/polling: Log failure to handle Offset Infinite Loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GochoMugo committed Feb 9, 2017
1 parent 179e728 commit b883259
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/telegramPolling.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TelegramBotPolling {
})
.catch(err => {
debug('polling error: %s', err.message);
/**
/*
* We need to mark the already-processed items
* to avoid fetching them again once the application
* is restarted, or moves to next polling interval
Expand All @@ -130,6 +130,21 @@ class TelegramBotPolling {
};
return this.bot.getUpdates(opts).then(() => {
return this._error(err);
}).catch(requestErr => {
/*
* We have been unable to handle this error.
* We have to log this to stderr to ensure devops
* understands that they may receive already-processed items
* on app restart.
*/
/* eslint-disable no-console */
const bugUrl = 'https://github.com/yagop/node-telegram-bot-api/issues/36#issuecomment-268532067';
console.error('error: Internal handling of The Offset Infinite Loop failed');
console.error(`error: This was due to error '${requestErr}'`);
console.error('error: You may receive already-processed updates on app restart');
console.error(`error: Please see ${bugUrl} for more information`);
/* eslint-enable no-console */
throw err;
});
})
.finally(() => {
Expand Down

0 comments on commit b883259

Please sign in to comment.