dispatchAndAwait

open suspend override fun dispatchAndAwait(action: ModuleAction): DispatchResult(source)

Dispatch an action and wait for it to be processed. Returns a DispatchResult indicating whether the action was applied or blocked.

Use this when you need to know the outcome of the dispatch, for example:

  • When middleware might block the action (spam protection)

  • When you need to perform follow-up work only if the action was applied

Return

DispatchResult.Processed if action was applied, DispatchResult.Blocked if middleware blocked the action, DispatchResult.Dropped if the store discarded it, for example because a reset swapped past it, DispatchResult.Error if processing failed

Parameters

action

The action to dispatch

Throws

when called from inside the dispatch pipeline, which would wait for itself. Middleware and ModuleLogic.beforeReset must use dispatch instead.