depoio / node-telegram-bot

Client wrapper for Telegram Bot API (Under heavy development)
MIT License
136 stars 30 forks source link

Further commits to improve 409 duplicate token problems #59

Closed sebastianarena closed 8 years ago

sebastianarena commented 8 years ago

It seems to me pointless to keep retrying polling if the user decided to stop. This is generating a ton of problems on my side, and stopping the infinite polling when unneeded seems to work (will continue to test on production thru the day).

Also, I took your new option for timeout and added it to getUpdates.

sebastianarena commented 8 years ago

Unfortunately this fix had little impact on the 409 problems :( they remain and crippling my server heavily, will continue to look and update the pull request when I find further problems

sebastianarena commented 8 years ago

I think the issue is deep down the latest code you've added. I don't know the reasons for many of the things you did, but I can't stop the 409 error. I had to revert to 0.1.4 that manages the polling differently. Will take a look from there on to see how to help you. I may have an idea, and it's related to my own code... but I think the bot isn't shutting down properly, and keeping the poll loop even after we've stopped it. Just a guess, will take a look.

sebastianarena commented 8 years ago

Just sent the final pull request. Take a look. This finally fixed all my problems. Will continue to test on production on multiple bots.

shernshiou commented 8 years ago

@kaminoo I am checking. Thanks for the pull request. Please add your name to contributors if possible.

sebastianarena commented 8 years ago

@shernshiou thank you for checking this out, hope you like the fixes, it's been more than 24hs and had 0 problems with the library. Fixing the 409 error was tough, but was actually based on your previous code. 0.1.4 was working fine, so I checked what changed and kind of reverted that with the new additions.

Once you feel this is ok I'll probably ask you if it would be possible to beautify the Bot.js code a little, and have 4-spaces tabs. It'll probably be a big commit since it will change everything, but I'll happily do it, since I plan to keep working on this library in the future. Just a suggestion, let me know how you feel.

shernshiou commented 8 years ago

@kaminoo yup thats the plan. Going to do some abstraction soon.