StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.87k stars 1.51k forks source link

Does StackExchange.Redis retries on cluster commands? #2556

Closed javedsha closed 11 months ago

javedsha commented 11 months ago

Hello,

Does the library retries on cluster commands like meet, nodes, set slot etc. in case of time out and connection failure? Looking at configuration, the only option I can see is the BacklogPolicy which by default will try to queue in case of connection failure unless the timeout for operation has reached.

Questions:

  1. The async timeout is applicable to all commands (async) including cluster commands, right?
  2. Is there any other way to specify number of retries? Or application should use libraries like Proxy and retry themselves.

Note: Our application is focus on cluster operations & management, and not the get/set operations.

Thanks.

NickCraver commented 11 months ago

We do not retry internally (because no single solution works for all, or takes into account pipelining). My standing suggestion is to use Polly or something similar here to retry as desired.

Note that when an exception is thrown in the case we've already sent the command (the message status is on the exception), we don't know if it was dropped on the way there or the response was dropped on the way back, that's just the nature of being a client on a roundtrip that sent but never got a result. Take that information into account when deciding whether you want to retry something!

javedsha commented 11 months ago

Thanks @NickCraver , this helps.