Skip to main content

Module workers_group

Module workers_group 

Source
Expand description

A Worker group’s index.ts (#3562, G2b step 2c-4b).

A [deploy.workers.<key>] group is one Worker over several contexts. Each member’s entry is emitted as <member>.index.ts in member mode (workers_entry.rs), which marks the router’s own misses; the group’s entry is the Worker’s main and dispatches to the members:

  • fetch tries the members in the order the manifest lists them. A marked response is a miss and the next member is tried; the first unmarked one is the answer (a handler’s own 404 included). If every member misses, the answer is the first marked response that is not a 404 (the synthesised 405/204), with the Allow of all such responses merged, since two members may serve one path under different methods; else the single-context Not Found.
  • scheduled runs every member whose cron matches, queue goes to the member consuming batch.queue, email to the member claiming the recipient.
  • Agent, events fan-out and container classes are re-exported by name (a member entry exports isMiss, so export * over members would collide).

A request to the internal /_bynk/call, /_bynk/event, /_bynk/migrate or (in a bynk dev build only) /_bynk/inspect prefix that no member claims is answered as a standalone Worker answers it unauthenticated: the same method gate, then the same 413 or 401 the runtime’s verifyCall gives. Answering 404 for an unknown service while a known one answers 401 would let an unsigned caller list a group’s services.

Structs§

GroupEntry
The group as a whole.
GroupMember
What the group’s entry needs to know of one member.

Functions§

emit_group_entry
The group’s index.ts.