supporting status for being able to retry, if command was never sent over the wire. by deepakverma · Pull Request #576 · StackExchange/StackExchange.Redis (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@deepakverma

I would like to get feedback on this proposal, where client application can read status of a command and to be able to retry if it was never sent over the wire.

var policy = Policy.Handle(p=> p.Commandstatus == CommandStatus.WaitingToBeSentToRedis) .Or(p=> p.CommandStatus == CommandStatus.WaitingToBeSentToRedis) .Retry(3,(exception, retrycount) => { //log("Try {0} failed with {1}", retrycount, exception); });

try { policy.Execute(() => conn.GetDatabase().StringGet("test")); } catch (Exception e) { //log }

@deepakverma

@NickCraver

I'm not sure that handling retries that way is a good overall approach, since often we'll lose them in-flight with a disconnect. The proportions of course subject to throughput and latency. That being said, I'm not against having this information on Message, but adding the calls here would have an impact on maximum throughput (however slight, but still).

@mgravell, thoughts? This information could lead to more informative error messages and debugging for sure.

@mgravell

This looks good to me; merging