diff --git a/Framework/Core/PluginTools.cs b/Framework/Core/PluginTools.cs index 5fd0ab8..ebd9d38 100644 --- a/Framework/Core/PluginTools.cs +++ b/Framework/Core/PluginTools.cs @@ -23,6 +23,7 @@ namespace Core public interface IHttpFactoryTool { IHttp CreateHttp(Address address, string baseUrl, Action onClientCreated, string? logAlias = null); + IHttp CreateHttp(Address address, string baseUrl, Action onClientCreated, ITimeSet timeSet, string? logAlias = null); IHttp CreateHttp(Address address, string baseUrl, string? logAlias = null); } @@ -53,7 +54,12 @@ namespace Core public IHttp CreateHttp(Address address, string baseUrl, Action onClientCreated, string? logAlias = null) { - return new Http(log, timeSet, address, baseUrl, onClientCreated, logAlias); + return CreateHttp(address, baseUrl, onClientCreated, timeSet, logAlias); + } + + public IHttp CreateHttp(Address address, string baseUrl, Action onClientCreated, ITimeSet ts, string? logAlias = null) + { + return new Http(log, ts, address, baseUrl, onClientCreated, logAlias); } public IHttp CreateHttp(Address address, string baseUrl, string? logAlias = null) diff --git a/Framework/Core/TimeSet.cs b/Framework/Core/TimeSet.cs index ff7a19e..2ca047f 100644 --- a/Framework/Core/TimeSet.cs +++ b/Framework/Core/TimeSet.cs @@ -36,4 +36,32 @@ return TimeSpan.FromMinutes(30); } } + + public class LongTimeSet : ITimeSet + { + public TimeSpan HttpCallTimeout() + { + return TimeSpan.FromHours(2); + } + + public TimeSpan HttpCallRetryTime() + { + return TimeSpan.FromHours(5); + } + + public TimeSpan HttpCallRetryDelay() + { + return TimeSpan.FromSeconds(2); + } + + public TimeSpan WaitForK8sServiceDelay() + { + return TimeSpan.FromSeconds(10); + } + + public TimeSpan K8sOperationTimeout() + { + return TimeSpan.FromMinutes(15); + } + } } diff --git a/ProjectPlugins/CodexPlugin/CodexAccess.cs b/ProjectPlugins/CodexPlugin/CodexAccess.cs index eb2cf6b..681dcf1 100644 --- a/ProjectPlugins/CodexPlugin/CodexAccess.cs +++ b/ProjectPlugins/CodexPlugin/CodexAccess.cs @@ -51,7 +51,7 @@ namespace CodexPlugin public CodexDebugRepoStoreResponse[] GetDebugRepoStore() { - return Http().HttpGetJson("debug/repostore"); + return LongHttp().HttpGetJson("debug/repostore"); } public CodexDebugThresholdBreaches GetDebugThresholdBreaches() @@ -101,6 +101,11 @@ namespace CodexPlugin return tools.CreateHttp(Container.Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, Container.Name); } + private IHttp LongHttp() + { + return tools.CreateHttp(Container.Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, new LongTimeSet(), Container.Name); + } + private void CheckContainerCrashed(HttpClient client) { if (hasContainerCrashed) throw new Exception("Container has crashed."); diff --git a/Tests/DistTestCore/LongTimeSet.cs b/Tests/DistTestCore/LongTimeSet.cs deleted file mode 100644 index cc441cc..0000000 --- a/Tests/DistTestCore/LongTimeSet.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Core; - -namespace DistTestCore -{ - public class LongTimeSet : ITimeSet - { - public TimeSpan HttpCallTimeout() - { - return TimeSpan.FromHours(2); - } - - public TimeSpan HttpCallRetryTime() - { - return TimeSpan.FromHours(5); - } - - public TimeSpan HttpCallRetryDelay() - { - return TimeSpan.FromSeconds(2); - } - - public TimeSpan WaitForK8sServiceDelay() - { - return TimeSpan.FromSeconds(10); - } - - public TimeSpan K8sOperationTimeout() - { - return TimeSpan.FromMinutes(15); - } - } -}