Privacywonk / MMM-Surf

MagicMirror module that pulls in tide, water temp, and Magicseaweed data to show an at-a-glance surf report for your favorite spot.
Other
5 stars 2 forks source link

setTimeout v. setInterval #21

Closed Privacywonk closed 6 years ago

Privacywonk commented 6 years ago

Investigate why app reaches out to refresh queries outside of 1hr setTimeout function.

Look into setting setInterval instead.

Privacywonk commented 6 years ago

Console log from an overnight run shows that the update mechanism is firing all over the place. API providers will not appreciate.


2018-03-25T06:08:36.934-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.480-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.507-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.515-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.537-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.543-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.678-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.685-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.690-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.728-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.732-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.737-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.787-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.790-0400 HELPER: setInterval called in fetchNOAAData: 3600000
2018-03-25T06:08:42.848-0400 HELPER: setInterval called in fetchNOAAData: 3600000
...```
Privacywonk commented 6 years ago

Updated in lasted dev train and release 1.1.0.

Issues:

  1. moved code from node_helper to MMM-Surf.js to update per client.
  2. Noticed condition that would cause massive triggering of legacy code by multiple clients (e.g. electron Browser opening on screen and web client.

Testing so far (~48 hours) shows code update has addressed both. Will continue to monitor.