Skip to content

fix(client): apply the command timeout and abortSignal to MULTI and pipelines on pool, cluster and sentinel - #3537

Open
Arthur031221 wants to merge 2 commits into
redis:masterfrom
Arthur031221:fix/batch-options-wrappers
Open

Arthur031221 wants to merge 2 commits into
redis:masterfrom
Arthur031221:fix/batch-options-wrappers

Conversation

@Arthur031221

@Arthur031221 Arthur031221 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Second of the two PRs for #3504, following #3515.

The timeout and abortSignal set through withCommandOptions(), withAbortSignal() or the options of a pool, cluster or sentinel weren't passed to multi().exec() and execAsPipeline(). The batch ran with the node client's own 5 s default, so a call with timeout: 100 waited 5 s while a single command rejected on time.

The three wrappers now pass both to the node client for each batch, through a small pickBatchOptions helper, as single commands do. An unset key keeps the node client's default and timeout: undefined opts out. As agreed in the issue, Sentinel batches follow the single command retry rule.

On a real Redis, a pool multi().exec() with timeout: 100 rejected after 5001 ms before and about 102 ms now.

Added tests in the pool, cluster and sentinel specs.


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Assisted by Claude/Codex.


Note

Medium Risk
Changes batch execution paths across pool, cluster, and sentinel; behavior aligns with single commands but affects timeout/abort semantics for all queued MULTI and pipeline calls.

Overview
Pool, cluster, and sentinel now forward timeout and abortSignal from withCommandOptions(), withAbortSignal(), or constructor commandOptions into multi().exec() and execAsPipeline(), matching single-command behavior.

A new pickBatchOptions helper copies only those keys when they are present (unset keeps the leased node client’s default; timeout: undefined still opts out). Pool, cluster, and sentinel wrap the leased client with withCommandOptions(batchOptions) before _executeMulti / _executePipeline.

Tests cover per-call timeout, abort signals, and opt-out via timeout: undefined on the pool; cluster and sentinel get similar coverage. blockSetImmediate is shared from test-utils for those tests, and cluster routing mocks stub withCommandOptions.

Reviewed by Cursor Bugbot for commit 17f2539. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T16:58:22.009346Z 72ad432 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72ad432670

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

isReadonly,
undefined,
(client, options) => client._executeMulti(
(client, options) => client.withCommandOptions(batchOptions)._executeMulti(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update cluster batch-routing doubles for the proxy call

In the @redis/client Mocha suite, the existing fakes in packages/client/lib/cluster/batch-routing.spec.ts (for example lines 11–20 and 39–48, plus the MOVED/ASK fakes) expose _executeMulti or _executePipeline but no withCommandOptions; because they are cast to never, type checking does not catch this, and the routing cases now fail here with TypeError: client.withCommandOptions is not a function before their assertions. Update those doubles (including the analogous pipeline path) or inject the batch options without adding this method requirement so the package suite remains runnable.

AGENTS.md reference: AGENTS.md:L54-L56

Useful? React with 👍 / 👎.

The cluster now calls withCommandOptions() on the node client before
_executeMulti and _executePipeline, so the fakes in batch-routing.spec.ts
need the method too.

This branch has not been deployed

No deployments
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