Skip to content

make the event handler an async fn#8

Merged
vilgotf merged 2 commits intomainfrom
vilgotf/async-handler
Feb 18, 2026
Merged

make the event handler an async fn#8
vilgotf merged 2 commits intomainfrom
vilgotf/async-handler

Conversation

@vilgotf
Copy link
Member

@vilgotf vilgotf commented Jan 13, 2026

Instead of the event handler being able to request state from its parent dispatcher, having it be provided ahead of time allows it to be an async fn. It is then no longer its responsibility to call TaskTracker::spawn (which you may otherwise forget to). Since the event handler no longer runs in the dispatcher task it also no longer inherit its span (so the handlers' spans have no default parent).

@vilgotf vilgotf force-pushed the vilgotf/async-handler branch from 45d5109 to 8d6a2f6 Compare January 13, 2026 07:06
@vilgotf vilgotf changed the title let event_handler be an async fn make the event handler an async fn Jan 13, 2026
@vilgotf vilgotf force-pushed the vilgotf/async-handler branch 2 times, most recently from e5b08b9 to c798166 Compare January 13, 2026 07:08
This works so long as the handler's future does not capture the shard.
@vilgotf vilgotf force-pushed the vilgotf/async-handler branch 6 times, most recently from 9b1a512 to 179b579 Compare January 16, 2026 07:34
It's much prettier for the event handler to be an `async fn` and,
following the separation of concerns principle, have it be injected
state through a separate provider.
@vilgotf vilgotf force-pushed the vilgotf/async-handler branch from 179b579 to 90e4511 Compare February 18, 2026 12:23
@vilgotf vilgotf merged commit bb6e56f into main Feb 18, 2026
2 checks passed
@vilgotf vilgotf deleted the vilgotf/async-handler branch February 18, 2026 12:27
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