-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTimeoutEvent.cs
More file actions
56 lines (49 loc) · 1.58 KB
/
TimeoutEvent.cs
File metadata and controls
56 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
namespace DotNet.Sdk.Extensions.Polly.Http.Timeout.Events;
/// <summary>
/// Contains the event data when a timeout is triggered via Polly's timeout policy.
/// </summary>
public sealed class TimeoutEvent
{
internal TimeoutEvent(
string httpClientName,
TimeoutOptions timeoutOptions,
Context context,
TimeSpan requestTimeout,
Task timedOutTask,
Exception exception)
{
HttpClientName = httpClientName;
TimeoutOptions = timeoutOptions;
Context = context;
RequestTimeout = requestTimeout;
TimedOutTask = timedOutTask;
Exception = exception;
}
/// <summary>
/// Gets the name of the HttpClient that triggered this event.
/// </summary>
public string HttpClientName { get; }
/// <summary>
/// Gets the timeout options applied to the HttpClient that triggered this event.
/// </summary>
public TimeoutOptions TimeoutOptions { get; }
/// <summary>
/// Gets the Polly Context.
/// </summary>
public Context Context { get; }
/// <summary>
/// Gets the timeout applied.
/// </summary>
public TimeSpan RequestTimeout { get; }
/// <summary>
/// Gets a <see cref="Task"/> capturing the abandoned, timed-out action.
/// </summary>
/// <remarks>
/// This will be null if the executed action responded cooperatively to cancellation before the policy timed it out.
/// </remarks>
public Task? TimedOutTask { get; }
/// <summary>
/// Gets the captured exception.
/// </summary>
public Exception Exception { get; }
}