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

supporting status for being able to retry, if command was never sent over the wire. #576

Merged
merged 1 commit into from Apr 6, 2017
Merged

Conversation

deepakverma
Copy link
Collaborator

@deepakverma deepakverma commented Feb 23, 2017

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<RedisTimeoutException>(p=> p.Commandstatus == CommandStatus.WaitingToBeSentToRedis)
.Or<RedisConnectionException>(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
}

@NickCraver
Copy link
Collaborator

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
Copy link
Collaborator

mgravell commented Apr 6, 2017

This looks good to me; merging

@mgravell mgravell merged commit 0476eb8 into StackExchange:master Apr 6, 2017
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.

None yet

3 participants