issue 1840/S6: emit through the same EventSink as the upgrade parts, so one connection serves both

This commit is contained in:
2026-10-22 14:32:10 +02:00
parent e4fb4cc793
commit 79ce72a7b7
2 changed files with 12 additions and 11 deletions
@@ -202,9 +202,13 @@ type emittedEvent struct {
id string
}
func (e *emitted) Emit(name string, body any, id string) error {
func (e *emitted) Emit(name string, body any, opts ...stdio.EmitOptions) error {
e.mu.Lock()
defer e.mu.Unlock()
id := ""
for _, o := range opts {
id = o.MessageID
}
e.events = append(e.events, emittedEvent{name, body, id})
return nil
}
@@ -318,7 +322,7 @@ func newTestKeeper(db *pacmanDB) (*Keeper, *fakeStates, *emitted, *fakeClock, fa
states, ev, clock := &fakeStates{}, &emitted{}, &fakeClock{now: t0}
w := fakeWatcher{make(chan Signal)}
m := machine(db.runner(), 1000)
k := &Keeper{Node: "node-a", Machine: m, State: states.State, Emit: ev.Emit, Clock: clock, Watcher: w,
k := &Keeper{Node: "node-a", Machine: m, State: states.State, Events: ev, Clock: clock, Watcher: w,
Logf: func(string, ...any) {}}
return k, states, ev, clock, w
}