tehp / OpenPoGoWeb

Web View for OpenPoGoBot
77 stars 58 forks source link

Don't use setInterval to update user data #155

Closed octa7th closed 7 years ago

octa7th commented 7 years ago

Using setInterval to fetch user data from Ajax is bad practice. We cannot assume one request will be finished before next request is called. The problem will likely appear when user have a bad internet connection or server in a high load.

screenshot from 2016 08 01 09 51 27

The solution is waiting for the Ajax request to complete and then call the next one. We can use Promise to help us implement this.

BobbyWibowo commented 7 years ago

wchill/refactor branch uses bluebird Promise to handle JSON loads. It's currently under development, but I heard it'll be the main focus.

octa7th commented 7 years ago

Sorry, I didn't check that branch yet.