Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cache option ignore errors #7630

Merged

Conversation

aniketawati
Copy link
Contributor

@aniketawati aniketawati commented May 7, 2021

Description of change

In case of cache errors like network failure, redis out of memory etc, default behaviour is to return that error to the caller.
But there are some cases where cache is only there to minimize database calls and its failure can be tolerated.
Issue #926 has been pending for this purpose.

This change introduces cacheoption - ignoreErrors and based on its value decides to throw the cache error or not.

Closes #926

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@AlexMesser AlexMesser merged commit 5fde0ea into typeorm:master May 8, 2021
@AlexMesser
Copy link
Collaborator

thank you for contribution!

@jason-hwang
Copy link

@aniketawati
First of all, thank you for your contribution.
and also, I have a question about this change.

Problem

In my expectation, my node-js server will not be broken If redis server is shutdown
when the ignoreErrors option is applied.

But I've faced the crash like this

Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)
error Command failed with exit code 1.

I know that is an abnormal case, but I assumed the redis server is broken by unpredictable scenarios.
Can you give more insight?

hkdobrev added a commit to ti-broish/api that referenced this pull request Jul 3, 2021
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.

[Feature Request] disable cache when redis is down
3 participants