Skip to content

Poll on task availability notices (4.6.0) - #232

Draft
andrejsimic wants to merge 1 commit into
feat/master/maestro-natsfrom
feat/master/task-availability-notifications
Draft

andrejsimic wants to merge 1 commit into
feat/master/maestro-natsfrom
feat/master/task-availability-notifications

Conversation

@andrejsimic

@andrejsimic andrejsimic commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Part of CxM-20: workers poll when Maestro announces that tasks are claimable, instead of on a timer. Stacked on #231; the base is feat/master/maestro-nats.

  • ITaskAvailabilityNotifications (ConductorSharp.Client): implemented by a transport that can announce which task types have work. Maestro's NATS transport does.
  • UseTaskAvailabilityNotifications(fallbackPollInterval): an execution manager that polls a type when it is announced and keeps polling until a poll comes back short. Otherwise it only polls on the fallback interval, so an idle worker sends nothing else. A notice that arrives during a poll keeps the type pending.
  • The per-task handling that both existing managers carried a copy of moved to PolledTaskRunner, which all three use.
  • The background service treats an OperationCanceledException on stop as a stop. The new manager waits on a semaphore and a channel, which throw that rather than TaskCanceledException.

4.6.0: new public API, and IExecutionManagerBuilder gains a member, which breaks any outside implementation of it. Not published; the Maestro draft consumes it as 4.6.0-task-notifications.1 from a local feed.

Tests: 87 pass, 8 new in NotifiedExecutionManagerTests.

Related: codaxy/cx-maestro#192 (Maestro publishes the notifications, and its NATS transport implements the interface).

A transport can now announce when tasks of a type may be waiting (ITaskAvailabilityNotifications,
in ConductorSharp.Client). UseTaskAvailabilityNotifications(fallbackPollInterval) switches to an
execution manager that polls a type when it is announced, keeps polling it until a poll comes back
short, and otherwise polls only on the fallback interval. An idle worker sends nothing else.
Maestro's NATS transport implements the interface.

- The per-task handling both execution managers carried a copy of moved to PolledTaskRunner,
  which all three use.
- The background service treats an OperationCanceledException on stop as a stop. The new manager
  waits on a semaphore and a channel, which throw that rather than TaskCanceledException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant