From 8a0a5941778290d2c0dc292d1b571c94b2797f6c Mon Sep 17 00:00:00 2001 From: yago Date: Sun, 12 Jul 2015 11:45:42 +0200 Subject: [PATCH] After polling error, keep trying --- src/telegram.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/telegram.js b/src/telegram.js index d2b2445..34363f2 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -111,6 +111,10 @@ TelegramBot.prototype._polling = function (timeout) { this.getUpdates(timeout).then(function (data) { self._processUpdates(data); self._polling(timeout); + }).catch(function (err) { + // console.error(err); + // Wait for 2 seconds before retry + setTimeout(self._polling.bind(self), 2000, timeout); }); };