2023-09-12 11:32:06 +00:00
|
|
|
|
namespace Core
|
2023-04-12 14:06:04 +00:00
|
|
|
|
{
|
|
|
|
|
public interface ITimeSet
|
|
|
|
|
{
|
2024-05-02 06:41:20 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Timeout for a single HTTP call.
|
|
|
|
|
/// </summary>
|
2023-04-12 14:06:04 +00:00
|
|
|
|
TimeSpan HttpCallTimeout();
|
2024-05-02 06:41:20 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum total time to attempt to make a successful HTTP call to a service.
|
|
|
|
|
/// When HTTP calls time out during this timespan, retries will be made.
|
|
|
|
|
/// </summary>
|
|
|
|
|
TimeSpan HttpRetryTimeout();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// After a failed HTTP call, wait this long before trying again.
|
|
|
|
|
/// </summary>
|
2023-05-10 07:55:36 +00:00
|
|
|
|
TimeSpan HttpCallRetryDelay();
|
2024-05-02 06:41:20 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// After a failed K8s operation, wait this long before trying again.
|
|
|
|
|
/// </summary>
|
2024-04-14 07:29:13 +00:00
|
|
|
|
TimeSpan K8sOperationRetryDelay();
|
2024-05-02 06:41:20 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum total time to attempt to perform a successful k8s operation.
|
|
|
|
|
/// If k8s operations fail during this timespan, retries will be made.
|
|
|
|
|
/// </summary>
|
2023-04-12 14:06:04 +00:00
|
|
|
|
TimeSpan K8sOperationTimeout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DefaultTimeSet : ITimeSet
|
|
|
|
|
{
|
|
|
|
|
public TimeSpan HttpCallTimeout()
|
|
|
|
|
{
|
2023-10-23 08:11:02 +00:00
|
|
|
|
return TimeSpan.FromMinutes(3);
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-02 06:41:20 +00:00
|
|
|
|
public TimeSpan HttpRetryTimeout()
|
2023-04-12 14:06:04 +00:00
|
|
|
|
{
|
2024-05-02 06:41:20 +00:00
|
|
|
|
return TimeSpan.FromMinutes(10);
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 07:55:36 +00:00
|
|
|
|
public TimeSpan HttpCallRetryDelay()
|
2023-04-12 14:06:04 +00:00
|
|
|
|
{
|
2023-06-08 11:23:26 +00:00
|
|
|
|
return TimeSpan.FromSeconds(1);
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-14 07:29:13 +00:00
|
|
|
|
public TimeSpan K8sOperationRetryDelay()
|
2023-04-12 14:06:04 +00:00
|
|
|
|
{
|
2023-08-16 08:52:44 +00:00
|
|
|
|
return TimeSpan.FromSeconds(10);
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan K8sOperationTimeout()
|
|
|
|
|
{
|
2023-08-16 08:52:44 +00:00
|
|
|
|
return TimeSpan.FromMinutes(30);
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-10 16:08:21 +00:00
|
|
|
|
|
|
|
|
|
public class LongTimeSet : ITimeSet
|
|
|
|
|
{
|
|
|
|
|
public TimeSpan HttpCallTimeout()
|
|
|
|
|
{
|
2024-05-02 06:41:20 +00:00
|
|
|
|
return TimeSpan.FromMinutes(30);
|
2023-10-10 16:08:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-02 06:41:20 +00:00
|
|
|
|
public TimeSpan HttpRetryTimeout()
|
2023-10-10 16:08:21 +00:00
|
|
|
|
{
|
2024-05-02 06:41:20 +00:00
|
|
|
|
return TimeSpan.FromHours(2.2);
|
2023-10-10 16:08:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan HttpCallRetryDelay()
|
|
|
|
|
{
|
2024-05-02 06:41:20 +00:00
|
|
|
|
return TimeSpan.FromSeconds(20);
|
2023-10-10 16:08:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-14 07:29:13 +00:00
|
|
|
|
public TimeSpan K8sOperationRetryDelay()
|
2023-10-10 16:08:21 +00:00
|
|
|
|
{
|
2024-04-14 07:29:13 +00:00
|
|
|
|
return TimeSpan.FromSeconds(30);
|
2023-10-10 16:08:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan K8sOperationTimeout()
|
|
|
|
|
{
|
2024-04-14 07:29:13 +00:00
|
|
|
|
return TimeSpan.FromHours(1);
|
2023-10-10 16:08:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-12 14:06:04 +00:00
|
|
|
|
}
|