The runtime serves a bundle its module's state (hq ADR 0201) #48
@@ -231,12 +231,14 @@ func Start(module, entry string, env []string, mesh Bus, logf func(string, ...an
|
||||
result = answered
|
||||
}
|
||||
case "mesh/state.watch":
|
||||
// Each change is asked of this child, in order; the watch is answered once the
|
||||
// current values have been handed over, so a bundle that awaits it has the whole
|
||||
// of the state before it goes on (ADR 0201).
|
||||
// Each change is asked of this child, in order, naming the watch it is for by
|
||||
// the id the child asked it with — two watches of one state are two handlers;
|
||||
// the watch is answered once the current values have been handed over, so a
|
||||
// bundle that awaits it has the whole of the state before it goes on (ADR 0201).
|
||||
var stop func()
|
||||
watch := m.ID
|
||||
stop, err = mesh.Watch(m.Params, func(change json.RawMessage) error {
|
||||
_, err := c.ask(module, "mesh/state", map[string]any{"change": change}, EventTimeout)
|
||||
_, err := c.ask(module, "mesh/state", map[string]any{"watch": watch, "change": change}, EventTimeout)
|
||||
return err
|
||||
})
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user