Skip to content

Add Invoke batching#3065

Merged
Apollon77 merged 12 commits intomainfrom
invoke-batching
Feb 16, 2026
Merged

Add Invoke batching#3065
Apollon77 merged 12 commits intomainfrom
invoke-batching

Conversation

@Apollon77
Copy link
Copy Markdown
Collaborator

invokes are now batched (when device supports it and non-root-endopoint and not groups) within the same macro-task

invokes are now batched (when device supports it and non-root-endopoint and not groups) within the same macro-task
@Apollon77 Apollon77 requested a review from lauckhart as a code owner January 22, 2026 08:27
Copilot AI review requested due to automatic review settings January 22, 2026 08:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic command batching to improve efficiency when multiple commands are invoked on a Matter device within the same timer tick. Commands sent to devices that support batching (maxPathsPerInvoke > 1) are now collected and sent as a single batched invoke request, reducing network overhead.

Changes:

  • Introduced CommandInvoker base class and CommandBatcher extension for intelligent command batching
  • Refactored ClientCommandMethod to use the new invoker infrastructure
  • Added batching support in ClientNodeInteraction while maintaining non-batching behavior for groups via ClientGroupInteraction

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/node/src/node/client/commands/CommandInvoker.ts New base class for command invocation with immediate execution logic
packages/node/src/node/client/commands/CommandBatcher.ts Implements batching logic that collects commands within a timer tick and sends them as a single request
packages/node/src/node/client/commands/ClientCommandMethod.ts Refactored to use the new invoker.invoke() API for batching support
packages/node/src/node/client/ClientNodeInteraction.ts Integrated CommandBatcher and added cleanup in close() method
packages/node/src/node/client/ClientGroupInteraction.ts Overrides to use plain CommandInvoker without batching for groups
packages/node/src/node/client/PeerBehavior.ts Updated import path for moved ClientCommandMethod
packages/node/src/node/ClientNode.ts Added prepareRuntimeShutdown() to close interaction and clean up batcher
packages/node/test/node/CommandBatcherTest.ts Comprehensive test suite covering batching scenarios, cache clearing, and error handling
packages/node/test/node/ClientNodeTest.ts Updated tests to use MockTime.resolve() for batched commands
packages/node/test/behaviors/scenes-management/ScenesManagementServerTest.ts Updated tests to use MockTime.resolve() for batched commands
packages/node/test/behaviors/group-key-management/GroupKeyManagementServerTest.ts Added comment explaining why root endpoint commands don't need MockTime.resolve()
CHANGELOG.md Documented the enhancement

Comment thread packages/node/src/node/client/commands/CommandBatcher.ts Outdated
Comment thread packages/node/src/node/client/commands/CommandBatcher.ts Outdated
Comment thread packages/node/src/node/client/commands/CommandBatcher.ts Outdated
Comment thread packages/node/src/node/client/commands/CommandBatcher.ts Outdated
Comment thread packages/node/src/node/client/commands/CommandBatcher.ts Outdated
Comment thread packages/node/src/node/client/commands/ClientCommandMethod.ts Outdated
Comment thread packages/node/src/node/client/commands/CommandInvoker.ts Outdated
Comment thread packages/node/src/node/client/ClientNodeInteraction.ts Outdated
Comment thread packages/protocol/src/action/client/ClientInteraction.ts Outdated
@Apollon77 Apollon77 merged commit 6192ae8 into main Feb 16, 2026
35 of 36 checks passed
@Apollon77 Apollon77 deleted the invoke-batching branch February 16, 2026 08:55
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.

3 participants