freakified / TimeStylePebble

A stylish, customizable face for the Pebble Time.
MIT License
177 stars 84 forks source link

Race condition in the javascript code #107

Open danielegobbetti opened 7 years ago

danielegobbetti commented 7 years ago

I believe there is a race condition in the JS code, that yields to https://github.com/Freeyourgadget/Gadgetbridge/issues/643 .

Specifically I am referring to this function.

If the localstorage key "disable_weather" is set to "yes", and the locationError gets called, the following happens:

  1. updateWeather() gets called by the ready event listener
  2. if weatherLoc is false, getLocation() is called
  3. if the current position returns error locationError gets called
  4. updateWeather() is called before incrementing currentFailures
  5. GOTO 1 (oh, the good basic times :-) )

h/t @LucaRainone for the help in diagnosing