paulw11 / homebridge-elkm1

Homebridge plugin for the Elk M1 alarm panel
MIT License
7 stars 6 forks source link

add maxRetryDelay variable and apply it in the error catch retry logic #48

Open tagdara opened 12 months ago

tagdara commented 12 months ago

https://github.com/paulw11/homebridge-elkm1/issues/35

When trying to back-off on re-attempts, it increases the initial delay (5000ms) by 2x on each error. Unfortunately if the Elk is having an issue, it doesn't take long to exceed the size of an int variable and you start to get these errors in the log:

(node:157) TimeoutOverflowWarning: kube62 homebridge fit into a 32-bit signed integer. 
[11/4/2023, 5:59:54 PM] kube62 homebridge connecting to ElkM1 ETIMEDOUT. Will retry in Infinitys |  
Timeout duration kube62 homebridge 1.

The fix would be to cap it at about 30 seconds which is very reasonable for polling a local device in an error state.