swarm: grant the controller STREAM.MSG.GET; list subagents concurrently
GET /api/agents/{name}/subagents reads each subagent's newest row with
get_last_raw_message_by_subject, which publishes
$JS.API.STREAM.MSG.GET.term-sub-<agent>. The controller's NATS grant had
no STREAM.MSG.GET, so every lookup was refused and waited the 10s request
timeout, one subagent after another; six subagents passed nginx's 60s.
Grant `$JS.API.STREAM.MSG.GET.*`. A wildcard matches a whole subject
token only, so a `term-sub-*` spelling would name one stream literally;
`*` is the narrowest grant that covers the per-agent streams, the same
width as the controller's STREAM.INFO.* grant.
The lookups now run concurrently (16 at a time) with a 2s timeout each.
A lookup that fails or times out lists its subagent with a null
last_row_unix, and one warn per request names how many failed and the
first error.
This commit is contained in:
parent
6ce01ff38d
commit
d81fb2236f
3 changed files with 76 additions and 26 deletions
|
|
@ -94,7 +94,10 @@ into a stream named `term-sub-<agent>` that swarm-controller creates for every
|
|||
declared agent. The stream keeps rows for 24 hours. swarm-controller serves the list as
|
||||
`GET /api/agents/<name>/subagents`, the subagents named by the subjects in that
|
||||
stream, each with `last_row_unix`, the stream's publish time of its newest row,
|
||||
and relays one subagent's rows as SSE on
|
||||
or `null` when that row isn't read within two seconds. The lookups run
|
||||
concurrently, sixteen at a time, so the list waits at most two seconds for
|
||||
each sixteen subagents.
|
||||
swarm-controller also relays one subagent's rows as SSE on
|
||||
`GET /api/agents/<name>/subagents/<subagent>/term/stream`. An agent with no
|
||||
store identity, or no queue address, publishes no subagent terminals.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue