Skip to content

redis - fix: move client initialization to constructor to prevent connection on module load (#1805)#1806

Merged
jaredwray merged 1 commit intomainfrom
claude/fix-issue-1805-rGj3k
Jan 14, 2026
Merged

redis - fix: move client initialization to constructor to prevent connection on module load (#1805)#1806
jaredwray merged 1 commit intomainfrom
claude/fix-issue-1805-rGj3k

Conversation

@jaredwray
Copy link
Owner

The class field initializer _client = createClient() was executing at module load time,
causing Redis connection attempts before any KeyvRedis instance was created. This caused
issues with:

  • Startup hangs when localhost:6379 is unavailable
  • OpenTelemetry instrumentation missing initialization
  • Serverless cold start delays
  • Testing complications with mock Redis

Moved client initialization from class field to constructor so connections only occur
when explicitly instantiating KeyvRedis or calling createKeyv().

…nection on module load (#1805)

The class field initializer `_client = createClient()` was executing at module load time,
causing Redis connection attempts before any KeyvRedis instance was created. This caused
issues with:
- Startup hangs when localhost:6379 is unavailable
- OpenTelemetry instrumentation missing initialization
- Serverless cold start delays
- Testing complications with mock Redis

Moved client initialization from class field to constructor so connections only occur
when explicitly instantiating KeyvRedis or calling createKeyv().
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f27fd72) to head (e0018bb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1806   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         2401      2402    +1     
  Branches       435       436    +1     
=========================================
+ Hits          2401      2402    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jaredwray
Copy link
Owner Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaredwray jaredwray merged commit d10f7cf into main Jan 14, 2026
10 checks passed
@jaredwray jaredwray deleted the claude/fix-issue-1805-rGj3k branch January 14, 2026 15:44
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