Plushie.Runtime.Commands (Plushie v0.7.2)

Copy Markdown View Source

Command execution engine for the Plushie runtime.

Handles all %Plushie.Command{} types returned by app.update/2 and app.init/1. The single public entry point is execute_commands/2, which threads state through each command and returns the updated state.

Summary

Functions

Maximum synchronous dispatch chain depth.

Executes a list of commands (or a single command), threading the runtime state through each one. Batch commands are flattened recursively.

Functions

dispatch_depth_limit()

Maximum synchronous dispatch chain depth.

Command.dispatch/1 queues a follow-up event in the runtime's mailbox. A pathological update that keeps emitting another Command.dispatch would fill the mailbox indefinitely; the runtime bumps a depth counter per chained event and drops the command when the counter reaches this cap.

execute_commands(commands, state)

@spec execute_commands([Plushie.Command.t()] | Plushie.Command.t(), map()) :: map()

Executes a list of commands (or a single command), threading the runtime state through each one. Batch commands are flattened recursively.