Detect initial update independently from timeout

This commit is contained in:
andig 2020-04-10 15:26:32 +02:00
parent 25b8b4d34b
commit c8f58117f9

View file

@ -164,12 +164,14 @@ func (h *msgHandler) waitForInitialValue() {
mlog.TRACE.Printf("%s wait for initial value", h.topic)
for {
updated := h.updated
// wait for update
h.mux.Unlock()
time.Sleep(waitTimeout)
h.mux.Lock()
if time.Since(h.updated) < h.timeout {
if updated != h.updated {
return
}
}