T2 drain at stop: finish the calls in flight within the drain bound, cut and say past it

Once told to stop, the tool runner makes no new ask of a bundle (a call after the stop is refused),
waits for the asks in flight within the drain bound (30 s by default), cuts each still in flight at
the bound with a journal line naming the bundle, the verb and the call's age, leaves its caller
unanswered (a transport fault), and only then stops its bundles itself.

Builds: design 47 H2 §813 (12), H-A-342 (2), H-A-353
This commit is contained in:
2026-11-21 23:11:38 +01:00
parent 02675a43ea
commit f7269d9812
7 changed files with 374 additions and 13 deletions
+6
View File
@@ -637,6 +637,12 @@ func (c *Conn) answerCalledOn(subject, queue string, h CalledHandler) (func(), e
go func() {
var r reply
result, err := h(callerOn(subject, msg.Subject), json.RawMessage(msg.Data))
// A call the runner's drain cut at its stop is answered nothing: its caller sees a transport fault (design 47 H2
// §813 (12)).
var unanswered interface{ Unanswered() bool }
if errors.As(err, &unanswered) && unanswered.Unanswered() {
return
}
if err != nil {
r.Error = err.Error()
} else {