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

Which Redis exceptions to retry on #566

Closed
swela-MSFT opened this issue Feb 3, 2017 · 3 comments
Closed

Which Redis exceptions to retry on #566

swela-MSFT opened this issue Feb 3, 2017 · 3 comments

Comments

@swela-MSFT
Copy link

As per StackExchange.Redis code, following exceptions seem like they need to be retried (connection error, sever error).

RedisServerException: Indicates an exception raised by a redis server

RedisConnectionException
Indicates a connection fault when communicating with redis

RedisException
Indicates an issue communicating with redis_

Is it safe to retry on these errors? Are they any other exceptions that need to be retried on?

Redis Best practices:
https://gist.github.com/JonCole/925630df72be1351b21440625ff2671f#when-is-it-safe-to-retry
puts onus on users of Redis for retries. But is silent which exceptions can be safely retried.

Thanks,

@NickCraver
Copy link
Collaborator

Where you retry depends on what you're trying to do, see my comments here on why it's so specific to the intent and not the exception:
#528 (comment)

@swela-MSFT
Copy link
Author

OK thanks for the link.
Follow up question:
If I decide to retry for errors in Redis operation:

  1. Should I create a new ConnectionMultiplexer and retry
  2. Or using existing ConnectionMultiplexer object for retries

In case of errors I perform following two operations:

  1. GetDatabase again
  2. StringSet\StringGet\ other Redis op that needs to be retried.

@NickCraver
Copy link
Collaborator

It depends on the error, if it's a connection error and you want to synchronously wait then you may create a new one. But doing so for a large number of commands would be very expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants