File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
ProjectPlugins/CodexClient Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ private Failure CaptureFailure(Exception ex)
94
94
private void CheckMaximums ( )
95
95
{
96
96
if ( Duration ( ) > maxTimeout ) Fail ( ) ;
97
+
98
+ // If we have a few very fast failures, retrying won't help us. There's probably something wrong with our operation.
99
+ // In this case, don't wait the full duration and fail quickly.
100
+ if ( failures . Count > 5 && failures . All ( f => f . Duration < TimeSpan . FromSeconds ( 1.0 ) ) ) Fail ( ) ;
97
101
}
98
102
99
103
private void Fail ( )
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public StorageRequest Map(CodexOpenApi.StorageRequest request)
128
128
Content = Map ( request . Content ) ,
129
129
Id = request . Id ,
130
130
Client = request . Client ,
131
- Expiry = TimeSpan . FromSeconds ( request . Expiry ) ,
131
+ Expiry = request . Expiry ,
132
132
Nonce = request . Nonce
133
133
} ;
134
134
}
@@ -137,12 +137,12 @@ public StorageAsk Map(CodexOpenApi.StorageAsk ask)
137
137
{
138
138
return new StorageAsk
139
139
{
140
- Duration = TimeSpan . FromSeconds ( ask . Duration ) ,
140
+ Duration = ask . Duration ,
141
141
MaxSlotLoss = ask . MaxSlotLoss ,
142
142
ProofProbability = ask . ProofProbability ,
143
- PricePerBytePerSecond = ToTestToken ( ask . PricePerBytePerSecond ) ,
143
+ PricePerBytePerSecond = ask . PricePerBytePerSecond ,
144
144
Slots = ask . Slots ,
145
- SlotSize = ToByteSize ( ask . SlotSize )
145
+ SlotSize = ask . SlotSize
146
146
} ;
147
147
}
148
148
Original file line number Diff line number Diff line change @@ -63,17 +63,17 @@ public class StorageRequest
63
63
public string Client { get ; set ; } = string . Empty ;
64
64
public StorageAsk Ask { get ; set ; } = null ! ;
65
65
public StorageContent Content { get ; set ; } = null ! ;
66
- public TimeSpan Expiry { get ; set ; }
66
+ public long Expiry { get ; set ; }
67
67
public string Nonce { get ; set ; } = string . Empty ;
68
68
}
69
69
70
70
public class StorageAsk
71
71
{
72
72
public long Slots { get ; set ; }
73
- public ByteSize SlotSize { get ; set ; } = 0 . Bytes ( ) ;
74
- public TimeSpan Duration { get ; set ; }
73
+ public long SlotSize { get ; set ; }
74
+ public long Duration { get ; set ; }
75
75
public string ProofProbability { get ; set ; } = string . Empty ;
76
- public TestToken PricePerBytePerSecond { get ; set ; } = 0 . Tst ( ) ;
76
+ public string PricePerBytePerSecond { get ; set ; } = string . Empty ;
77
77
public long MaxSlotLoss { get ; set ; }
78
78
}
79
79
You can’t perform that action at this time.
0 commit comments