Subscribe as soon as the runtime serves, never after a guessed wait, so no event sent at a start is missed (issue 774)
mesh/delivery merged: source.main moved to novox/mesh-catalog@5d9cead336ab
mesh/delivery-group group fix/held-module-and-assigner-contract merged: every member is merged
mesh/check checking b5475cfa5c3d on 395a37dddab9 | novox/mesh-catalog#571 in group fix/held-module-and-assigner-contract
mesh/delivery merged: source.main moved to novox/mesh-catalog@5d9cead336ab
mesh/delivery-group group fix/held-module-and-assigner-contract merged: every member is merged
mesh/check checking b5475cfa5c3d on 395a37dddab9 | novox/mesh-catalog#571 in group fix/held-module-and-assigner-contract
mesh-healers slept 2 s before its first subscribe to the keeper's conditions; its whole test delivered condition-raised once the lease was read, often before that, and the event was dropped: "never: the would-act written" in about two runs of three on main, failing the group check. Eight modules had the same shape. Quick fix: sleep after a failed subscribe in mesh-healers alone. Thorough fix (chosen, the kind is in eight modules): every loop that asks the runtime for events or a watch waits for stdio.Served() and subscribes at once, sleeping only after a refusal (mesh-healers, mesh-config, mesh-mail, mesh-issues, mesh-provisioner, mesh-watcher, mesh-delivery-gate); mesh-knowledge, whose pinned mesh-sdk has no Served, subscribes first and sleeps after a refusal. The healers' whole test delivers the event only once the bundle has subscribed it, as the runtime's consumer holds it until then.
This commit is contained in:
@@ -136,8 +136,8 @@ func main() {
|
||||
return nil
|
||||
})
|
||||
go func() {
|
||||
<-stdio.Served() // subscribed as soon as the runtime serves, never after a guessed wait: an event sent meanwhile is heard
|
||||
for wait := 2 * time.Second; ; wait = min(wait*2, time.Minute) {
|
||||
time.Sleep(wait)
|
||||
err := stdio.Subscribe(asks.Seat+".decided."+Module, func(stdio.Envelope) error {
|
||||
for _, said := range h.Decide() {
|
||||
logf("[%s] %s", Module, said)
|
||||
@@ -148,6 +148,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
logf("[%s] does not hear the operator's answers yet (%v); asking again in %s", Module, err, wait)
|
||||
time.Sleep(wait)
|
||||
}
|
||||
}()
|
||||
if err := stdio.Serve("", append(Tools(s), holderTools(h)...)); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user