mesh-vault starts its passes once Serve holds the runtime's channel: started earlier every watch is refused and waits for the minute's pass (issue 774)
mesh/check being carried to cbea2470d225 on df8168f4843f | from 559939aa8ce1
mesh/delivery merged: source.main moved to novox/mesh-catalog@df8168f4843f
mesh/check being carried to cbea2470d225 on df8168f4843f | from 559939aa8ce1
mesh/delivery merged: source.main moved to novox/mesh-catalog@df8168f4843f
Checked by TestTheVaultWholeRotatesANodesLoginWithAStandInEngine: the race it met is what this closes. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -302,9 +302,20 @@ func readPlanRaw(key string) ([]byte, error) {
|
||||
// assignmentKeys is every key of the controller's assignments mirror, read the same way.
|
||||
func assignmentKeys() ([]string, error) { return stdio.State(AssignmentsRead).Keys() }
|
||||
|
||||
// Checked by TestTheVaultWholeRotatesANodesLoginWithAStandInEngine: the race it met (a pass before Serve, every watch
|
||||
// refused, the rotation waiting for the minute's pass) is what this closes.
|
||||
// afterServed runs f once served is closed, that is once stdio.Serve holds the runtime's channel: every function of the
|
||||
// bus refuses before that ("before Serve"), and a watch refused then waits for the minute's pass.
|
||||
func afterServed(served <-chan struct{}, f func()) {
|
||||
go func() {
|
||||
<-served
|
||||
f()
|
||||
}()
|
||||
}
|
||||
|
||||
func main() {
|
||||
env := build()
|
||||
go func() {
|
||||
afterServed(stdio.Served(), func() {
|
||||
tick := time.NewTicker(time.Minute)
|
||||
defer tick.Stop()
|
||||
// At start, every covered account it holds whose hash is not of its current generation (ADR 0547 clause 9).
|
||||
@@ -361,7 +372,7 @@ func main() {
|
||||
}
|
||||
<-tick.C
|
||||
}
|
||||
}()
|
||||
})
|
||||
if err := stdio.Serve("", tools(env)); err != nil {
|
||||
say("%v", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user