I think we should change the polling mechanism from setInterval to setTimeout
If the bot experiences slow internet connectivity, the setInterval function will trigger the callback multiple times before the first callback is complete and the message offset is updated. This results in the same messages being handled multiple times.
If we change this to be setTimeout and recreate a new timeout once the old one completes, this problem should not occur anymore.
The bot will then effectively "lag" until the getUpdates call is complete or fails. Thoughts, @lukefx?
I think we should change the polling mechanism from
setInterval
tosetTimeout
If the bot experiences slow internet connectivity, the
setInterval
function will trigger the callback multiple times before the first callback is complete and the message offset is updated. This results in the same messages being handled multiple times.If we change this to be
setTimeout
and recreate a new timeout once the old one completes, this problem should not occur anymore.The bot will then effectively "lag" until the
getUpdates
call is complete or fails. Thoughts, @lukefx?