diff --git a/Framework/Utils/Retry.cs b/Framework/Utils/Retry.cs index 8bd758d3..da22fb65 100644 --- a/Framework/Utils/Retry.cs +++ b/Framework/Utils/Retry.cs @@ -94,6 +94,10 @@ private void CheckMaximums() { if (Duration() > maxTimeout) Fail(); + + // If we have a few very fast failures, retrying won't help us. There's probably something wrong with our operation. + // In this case, don't wait the full duration and fail quickly. + if (failures.Count > 5 && failures.All(f => f.Duration < TimeSpan.FromSeconds(1.0))) Fail(); } private void Fail() diff --git a/ProjectPlugins/CodexClient/Mapper.cs b/ProjectPlugins/CodexClient/Mapper.cs index 5a4cffac..f53d06d1 100644 --- a/ProjectPlugins/CodexClient/Mapper.cs +++ b/ProjectPlugins/CodexClient/Mapper.cs @@ -128,7 +128,7 @@ namespace CodexClient Content = Map(request.Content), Id = request.Id, Client = request.Client, - Expiry = TimeSpan.FromSeconds(request.Expiry), + Expiry = request.Expiry, Nonce = request.Nonce }; } @@ -137,12 +137,12 @@ namespace CodexClient { return new StorageAsk { - Duration = TimeSpan.FromSeconds(ask.Duration), + Duration = ask.Duration, MaxSlotLoss = ask.MaxSlotLoss, ProofProbability = ask.ProofProbability, - PricePerBytePerSecond = ToTestToken(ask.PricePerBytePerSecond), + PricePerBytePerSecond = ask.PricePerBytePerSecond, Slots = ask.Slots, - SlotSize = ToByteSize(ask.SlotSize) + SlotSize = ask.SlotSize }; } diff --git a/ProjectPlugins/CodexClient/MarketplaceTypes.cs b/ProjectPlugins/CodexClient/MarketplaceTypes.cs index 161f6d17..2306f30e 100644 --- a/ProjectPlugins/CodexClient/MarketplaceTypes.cs +++ b/ProjectPlugins/CodexClient/MarketplaceTypes.cs @@ -63,17 +63,17 @@ namespace CodexClient public string Client { get; set; } = string.Empty; public StorageAsk Ask { get; set; } = null!; public StorageContent Content { get; set; } = null!; - public TimeSpan Expiry { get; set; } + public long Expiry { get; set; } public string Nonce { get; set; } = string.Empty; } public class StorageAsk { public long Slots { get; set; } - public ByteSize SlotSize { get; set; } = 0.Bytes(); - public TimeSpan Duration { get; set; } + public long SlotSize { get; set; } + public long Duration { get; set; } public string ProofProbability { get; set; } = string.Empty; - public TestToken PricePerBytePerSecond { get; set; } = 0.Tst(); + public string PricePerBytePerSecond { get; set; } = string.Empty; public long MaxSlotLoss { get; set; } }