proxy: add random reload offset for HA

This commit is contained in:
Jens Langhammer
2020-10-17 16:48:53 +02:00
parent 903cdeaa7f
commit f9cede7b31
2 changed files with 7 additions and 0 deletions

View File

@ -82,6 +82,7 @@ func (ac *APIController) startWSHandler() {
continue
}
if wsMsg.Instruction == WebsocketInstructionTriggerUpdate {
time.Sleep(ac.reloadOffset)
err := ac.UpdateIfRequired()
if err != nil {
ac.logger.WithField("loop", "ws-handler").WithError(err).Debug("Failed to update")