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
|
result = answered
|
||||||
}
|
}
|
||||||
case "mesh/state.watch":
|
case "mesh/state.watch":
|
||||||
// Each change is asked of this child, in order; the watch is answered once the
|
// Each change is asked of this child, in order, naming the watch it is for by
|
||||||
// current values have been handed over, so a bundle that awaits it has the whole
|
// the id the child asked it with — two watches of one state are two handlers;
|
||||||
// of the state before it goes on (ADR 0201).
|
// 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()
|
var stop func()
|
||||||
|
watch := m.ID
|
||||||
stop, err = mesh.Watch(m.Params, func(change json.RawMessage) error {
|
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
|
return err
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user