Nicnl / homebridge-minimal-http-blinds

GNU General Public License v3.0
12 stars 13 forks source link

Knic/timed stale cache #8

Closed KnicKnic closed 5 years ago

KnicKnic commented 5 years ago

Should address https://github.com/Nicnl/homebridge-minimal-http-blinds/issues/5 The problem was 2 fold.

  1. The state callbacks broke after a timeout due to a copy paste error.
    1. Addressed via not manually scheduling callbacks to occur and just set them to repeat. (removed typo)
  2. If the webserver was down, iphone would not go onto next device in bridge due to callbacks only getting completed on success (unsure if it eventually times out and does)
    1. Addressed by calling completion callbacks with cached data on error.

Lastly I added a feature that if there is no app (60 seconds) activity to immediately return cached results. This fits my usage pattern where I have a longer polling intervals and also fixes longer initial load times if the webserver is down and a timeout has to first occur.

Lastly updated docs & bumped package version.

I know of no known regressions introduced.

Nicnl commented 5 years ago

Wow, thank you, you even bumped the package version on npm

I'm merging this and pushing it, and I'll ask the other people is they still encounter the issues