H-A-197: the tool runner claims each durable it pulls through the SDK's guard
A tool runner built before H-A-132/133 ran two pull loops on the indexer bundle's one durable, each event reached one loop only, and nothing said so; the SDK's guard (H-A-196) could not see it, since the runner bound through the bus client directly. hearing.bind now claims each durable with process.PullOnce, naming the runner's hearing and the part that asked it, and releases the claim as the loop is stopped or drained, or as the bus ends it, so a re-serve (which stops its old loop first) binds again without a refusal. The heartbeat test's second consume pulled the same durable: it gets its own. Builds: design 47 H H-A-197, H-A-196
This commit is contained in:
@@ -258,6 +258,34 @@ func TestAConsumerNamedBeforeItExistsIsBoundOnceItDoes(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// A second pull loop on the durable the runner pulls is refused, naming it and both binders (design 47 H, H-A-196,
|
||||
// H-A-197); a re-serve that stops its loop first binds again without a refusal, its module stream's durable too.
|
||||
if _, err := conn.ConsumeAs("reader", func(bus.Envelope) error { return nil }); err == nil ||
|
||||
!strings.Contains(err.Error(), "pulled in this process already") || !strings.Contains(err.Error(), "anchor_reader") ||
|
||||
strings.Count(err.Error(), "the tool runner's hearing of reader") != 2 {
|
||||
t.Fatalf("a second pull loop on the durable the runner pulls was not refused naming it and both binders: %v", err)
|
||||
}
|
||||
stop()
|
||||
again, err := conn.ConsumeAs("reader", func(env bus.Envelope) error {
|
||||
mu.Lock()
|
||||
heard[env.Key]++
|
||||
mu.Unlock()
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("the re-serve was refused after its old loop stopped: %v", err)
|
||||
}
|
||||
t.Cleanup(again)
|
||||
mesh.Emit(t, "mesh.stream.mail.event.mail.home.message.added", map[string]any{})
|
||||
mt.Until(t, func() error {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if heard["mail.mail.home.message.added"] != 2 {
|
||||
return fmt.Errorf("after the re-serve heard %v", heard)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// novox/hq ADR 0363 §6 (issue 725): a consumer the controller deletes and makes again under the same name, its
|
||||
|
||||
Reference in New Issue
Block a user