Skip to content

feat(dispatcher): LeastLoadedDispatcher.route() returns the result - #21

Merged
adnanhd merged 1 commit into
mainfrom
feat/least-loaded-route
Jun 24, 2026
Merged

feat(dispatcher): LeastLoadedDispatcher.route() returns the result#21
adnanhd merged 1 commit into
mainfrom
feat/least-loaded-route

Conversation

@adnanhd

@adnanhd adnanhd commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Factors the atomic select-and-reserve out of dispatch() into a shared _select(), and adds route(subscribers, *args, **kwargs) -> Any — the result-returning counterpart of the fire-and-forget dispatch(). A scheduler that needs the value back (e.g. torchestrator's pools) can now reuse the load-aware routing + atomic reservation instead of reimplementing it. dispatch() behaviour is unchanged (saturated propagates, handler errors swallowed/logged); route() propagates handler errors and releases the reservation either way. Tests for route's result, error-propagation, and release. 32 green, lint/mypy clean.

Factors the atomic select-and-reserve into _select(), shared by the existing
fire-and-forget dispatch() and a new route() that invokes the chosen
subscriber and returns its result (propagating errors). Lets a scheduler
reuse the load-aware routing instead of reimplementing it.
@adnanhd
adnanhd merged commit 0992682 into main Jun 24, 2026
3 checks passed
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