Skip to content

fix(client): include acquire timeout duration in pool timeout error message - #3382

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
Piyush0049:fix/pool-acquire-timeout-message
Jul 30, 2026
Merged

fix(client): include acquire timeout duration in pool timeout error message#3382
nkaradzhov merged 1 commit into
redis:masterfrom
Piyush0049:fix/pool-acquire-timeout-message

Conversation

@Piyush0049

@Piyush0049 Piyush0049 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request addresses a maintainer TODO comment (// TODO: message) in pool.ts by formatting the TimeoutError message thrown when acquireTimeout expires while waiting for a client from the pool.

Background

Previously, when a task timed out waiting for an available client in RedisClientPool, the operation rejected with a static string TimeoutError('Timeout waiting for a client'). This lacked diagnostic details about the configured timeout duration.

Key Changes

  1. Formatted Error Message: Updated pool.ts to dynamically include the configured timeout duration in milliseconds: Timeout waiting for a client after ${acquireTimeout}ms.
  2. Added Unit Test: Added a test case in pool.spec.ts (rejects with TimeoutError when acquireTimeout expires) to verify that acquire timeout rejections produce a TimeoutError with the formatted message.

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)?

Note

Low Risk
Only the timeout error message text changes; pool acquire logic is unchanged aside from clearer diagnostics.

Overview
When RedisClientPool cannot hand out a client before acquireTimeout, the rejection now uses a TimeoutError message that includes the configured wait time (e.g. Timeout waiting for a client after 50ms) instead of a fixed string.

A pool integration test was added to hold the sole client busy, trigger a second execute with a short acquireTimeout, and assert the error type and message.

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

@nkaradzhov
nkaradzhov merged commit 87623a6 into redis:master Jul 30, 2026
15 checks passed
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.

2 participants