S16 addendum: a waiting ask says when it waits again after a nak

Builds: design 47 H2 §777, H-A-410 and its addendum
This commit is contained in:
2026-11-22 01:00:24 +01:00
parent d6cdf3b8f5
commit ed281663fd
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -266,11 +266,13 @@ func subjectMatches(pattern, subject string) bool {
} }
// WaitingAsk is one ask waiting in a seat's work queue, as the runtime reads it without taking it (design 47 H2 §777, // WaitingAsk is one ask waiting in a seat's work queue, as the runtime reads it without taking it (design 47 H2 §777,
// H-A-410): the ask's id, the module that asked it and its age in seconds. // H-A-410): the ask's id, the module that asked it and its age in seconds. Again says it was handed out and handed back
// (a nak) and no worker holds it: waiting again (H-A-410's addendum).
type WaitingAsk struct { type WaitingAsk struct {
ID string `json:"id"` ID string `json:"id"`
Module string `json:"module"` Module string `json:"module"`
AgeSeconds float64 `json:"age_seconds"` AgeSeconds float64 `json:"age_seconds"`
Again bool `json:"again,omitempty"`
} }
// Waiting is the asks waiting in a seat's work queue, oldest first as the queue holds them; Capped says the runtime cut // Waiting is the asks waiting in a seat's work queue, oldest first as the queue holds them; Capped says the runtime cut
+2 -2
View File
@@ -158,7 +158,7 @@ func TestInfoIsTheBucketsFillAgainstItsCaps(t *testing.T) {
return map[string]any{"error": map[string]any{"code": -32000, "message": "issued no queue of that seat"}} return map[string]any{"error": map[string]any{"code": -32000, "message": "issued no queue of that seat"}}
} }
return map[string]any{"result": map[string]any{"asks": []map[string]any{{"id": "main.9", "module": "mesh-delivery-pipeline", return map[string]any{"result": map[string]any{"asks": []map[string]any{{"id": "main.9", "module": "mesh-delivery-pipeline",
"age_seconds": 42}, {"id": "main.10", "module": "mesh-delivery-pipeline", "age_seconds": 1.5}}, "capped": true}} "age_seconds": 42}, {"id": "main.10", "module": "mesh-delivery-pipeline", "age_seconds": 1.5, "again": true}}, "capped": true}}
} }
if p["state"] != "issues" { if p["state"] != "issues" {
return map[string]any{"error": map[string]any{"code": -32000, "message": "issues was issued no state"}} return map[string]any{"error": map[string]any{"code": -32000, "message": "issues was issued no state"}}
@@ -180,7 +180,7 @@ func TestInfoIsTheBucketsFillAgainstItsCaps(t *testing.T) {
_, waitingRefused = QueueWaiting("node-build-go") _, waitingRefused = QueueWaiting("node-build-go")
}) })
if w := waiting; !w.Capped || len(w.Asks) != 2 || w.Asks[0] != (WaitingAsk{ID: "main.9", Module: "mesh-delivery-pipeline", AgeSeconds: 42}) || if w := waiting; !w.Capped || len(w.Asks) != 2 || w.Asks[0] != (WaitingAsk{ID: "main.9", Module: "mesh-delivery-pipeline", AgeSeconds: 42}) ||
w.Asks[1].AgeSeconds != 1.5 { w.Asks[1] != (WaitingAsk{ID: "main.10", Module: "mesh-delivery-pipeline", AgeSeconds: 1.5, Again: true}) {
t.Errorf("the waiting asks are %+v", w) t.Errorf("the waiting asks are %+v", w)
} }
if waitingRefused == nil || !strings.Contains(waitingRefused.Error(), "issued no queue") { if waitingRefused == nil || !strings.Contains(waitingRefused.Error(), "issued no queue") {