Skip to content

Fix excessive Redis log spam when Redis is unavailable#649

Draft
valentin0h wants to merge 2 commits intodevfrom
redis-logs
Draft

Fix excessive Redis log spam when Redis is unavailable#649
valentin0h wants to merge 2 commits intodevfrom
redis-logs

Conversation

@valentin0h
Copy link
Collaborator

Summary

  • Replace per-event Redis error logging with state-based transition logging — only one log line is emitted when Redis goes down and one when it reconnects
  • get() and set() now short-circuit immediately when Redis is known to be unavailable, eliminating per-request error noise
  • Swallow the initial .connect() rejection since the error event handler already covers the transition

Before

Every Redis retry (up to 5 per cycle) and every API request hitting cache() while Redis was down produced a full logger.error() with stack trace — hundreds of lines per minute during local dev.

After

A single [WARN] Redis connection lost — cache operations will fall through to DB when Redis goes down, and [INFO] Redis connected when it comes back. Zero noise in between.

Replace per-event error logging with state-based transition logging.
A redisAvailable flag tracks connectivity so get/set short-circuit
silently when Redis is down, and only one log line is emitted per
state change instead of per retry and per request.
The previous cap of 3 retries meant Redis was permanently disabled for
the process lifetime after any outage. With the redisAvailable guard
already short-circuiting get/set, retries cost nothing — just backoff
up to 30s so the ready event can fire when Redis comes back.
@vercel
Copy link
Contributor

vercel bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview Feb 21, 2026 11:27pm

Request Review

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