Skip to content

Fixed unhandled promise rejection in Redis adapter _get timeout path#27007

Open
muratcorlu wants to merge 2 commits intoTryGhost:mainfrom
muratcorlu:fix/redis-adapter-get-unhandled-rejection
Open

Fixed unhandled promise rejection in Redis adapter _get timeout path#27007
muratcorlu wants to merge 2 commits intoTryGhost:mainfrom
muratcorlu:fix/redis-adapter-get-unhandled-rejection

Conversation

@muratcorlu
Copy link
Copy Markdown
Contributor

@muratcorlu muratcorlu commented Mar 27, 2026

When getTimeoutMilliseconds was configured, _get wrapped the cache read in a new Promise but did not handle rejections from the inner cache.get() call. If Redis rejected the command (e.g. with enableOfflineQueue: false), the rejection went unhandled, which crashes Ghost.

Fixed by adding a .catch() that clears the timeout and resolves with null, treating a Redis error during a timed get as a cache miss.

Got some code for us? Awesome 🎊!

Please take a minute to explain the change you're making:

  • Why are you making it?
  • What does it do?
  • Why is this something Ghost users or developers need?

Please check your PR against these items:

  • I've read and followed the Contributor Guide
  • I've explained my change
  • I've written an automated test to prove my change works

We appreciate your contribution! 🙏

muratcorlu and others added 2 commits March 28, 2026 00:15
When getTimeoutMilliseconds was configured, _get wrapped the cache read
in a new Promise but did not handle rejections from the inner cache.get()
call. If Redis rejected the command (e.g. with enableOfflineQueue: false),
the rejection went unhandled, which crashes Ghost.

Fixed by adding a .catch() that clears the timeout and resolves with null,
treating a Redis error during a timed get as a cache miss.
@sonarqubecloud
Copy link
Copy Markdown

@muratcorlu muratcorlu changed the title 🐛 Fixed unhandled promise rejection in Redis adapter _get timeout path Fixed unhandled promise rejection in Redis adapter _get timeout path Mar 27, 2026
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