-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This won't be fully accurate until #1947 fixed the PING routing, but getting a test fix into main ahead of time.
- Loading branch information
1 parent
51272b3
commit fa9e1c3
Showing
2 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace StackExchange.Redis | ||
{ | ||
/// <summary> | ||
/// The backlog policy to use for commands. This policy comes into effect when a connection is unhealthy or unavailable. | ||
/// The policy can choose to backlog commands and wait to try them (within their timeout) against a connection when it comes up, | ||
/// or it could choose to fail fast and throw ASAP. Different apps desire different behaviors with backpressure and how to handle | ||
/// large amounts of load, so this is configurable to optimize the happy path but avoid spiral-of-death queue scenarios for others. | ||
/// </summary> | ||
public class BacklogPolicy | ||
{ | ||
/// <summary> | ||
/// Backlog behavior matching StackExchange.Redis's 2.x line, failing fast and not attempting to queue | ||
/// and retry when a connection is available again. | ||
/// </summary> | ||
public static BacklogPolicy FailFast { get; } = new() | ||
{ | ||
QueueWhileDisconnected = false, | ||
AbortPendingOnConnectionFailure = true, | ||
}; | ||
|
||
/// <summary> | ||
/// Default backlog policy which will allow commands to be issues against an endpoint and queue up. | ||
/// Commands are still subject to their async timeout (which serves as a queue size check). | ||
/// </summary> | ||
public static BacklogPolicy Default { get; } = new() | ||
{ | ||
QueueWhileDisconnected = true, | ||
AbortPendingOnConnectionFailure = false, | ||
}; | ||
|
||
/// <summary> | ||
/// Whether to queue commands while disconnected. | ||
/// True means queue for attempts up until their timeout. | ||
/// False means to fail ASAP and queue nothing. | ||
/// </summary> | ||
public bool QueueWhileDisconnected { get; init; } | ||
|
||
/// <summary> | ||
/// Whether to immediately abandon (with an exception) all pending commands when a connection goes unhealthy. | ||
/// </summary> | ||
public bool AbortPendingOnConnectionFailure { get; init; } | ||
} | ||
} |
This file contains 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