Skip to main content

Module RegisterCommand

Module RegisterCommand 

Source
Expand description

Cocoon → Mountain registerCommand notification. Stores the command as a Proxied handler in Mountain’s CommandRegistry so subsequent commands.executeCommand calls get routed back to Cocoon via $executeContributedCommand gRPC.

§Batching

Extension boot fires 1000+ registerCommand notifications in a tight burst. Rather than spawning one short-lived tokio task per call (and always sleeping 16 ms even for the last item), we push into a mpsc::unbounded_channel and a single long-lived flusher task drains it: it wakes immediately when the first item arrives, collects everything already queued via recv_many, then sleeps 16 ms and drains a second time to catch stragglers - then emits one batch event. The net effect is identical to the old coalescer but avoids 1000+ task spawns and reduces the minimum latency to sub-millisecond for isolated commands registered after boot.

Structs§

CommandBatchChannel 🔒

Statics§

CMD_CHANNEL 🔒

Functions§

GetOrInitChannel 🔒
RegisterCommand