@@ -194,34 +194,18 @@ pub enum ApplyUpdateError {
194
194
WaitError ( #[ source] PrecheckError ) ,
195
195
}
196
196
197
- /// Construct an MGS client.
198
- //
199
- // We split this into a prod version and a test version to work around timeout
200
- // issues in tests. In practice we expect basically all requests to MGS to be
201
- // fulfilled very quickly, even in tests, but our test infrastructure allows us
202
- // to _pause_ an update for extended periods of time. If we start an update then
203
- // happen to pause it as its making an MGS request, leave it paused for more
204
- // than 15 seconds (the default progenitor client timeout), then try to resume
205
- // it, we'll immediately fail with a timeout (even though MGS is perfectly
206
- // responsive!).
207
- #[ cfg( not( test) ) ]
208
- fn make_mgs_clients ( backends : & AllBackends , log : & slog:: Logger ) -> MgsClients {
209
- MgsClients :: from_clients ( backends. iter ( ) . map ( |( backend_name, backend) | {
210
- gateway_client:: Client :: new (
211
- & format ! ( "http://{}" , backend. address) ,
212
- log. new ( o ! (
213
- "mgs_backend_name" => backend_name. 0 . to_string( ) ,
214
- "mgs_backend_addr" => backend. address. to_string( ) ,
215
- ) ) ,
216
- )
217
- } ) )
218
- }
219
- #[ cfg( test) ]
197
+ /// Construct a set of MGS clients.
220
198
fn make_mgs_clients ( backends : & AllBackends , log : & slog:: Logger ) -> MgsClients {
221
199
MgsClients :: from_clients ( backends. iter ( ) . map ( |( backend_name, backend) | {
200
+ // MGS has its own timeouts it applies to communications on our behalf
201
+ // to SPs. The longest of these timeouts is currently set to 60 seconds
202
+ // (specifically: MGS will wait up to 60 seconds for devices to reset,
203
+ // because we've seen sidecars take 20+ seconds to reset). We should
204
+ // therefore wait at least as long as its timeouts; we'll add a buffer
205
+ // here to leave plenty of time for minor weather between us and MGS.
222
206
let client = reqwest:: ClientBuilder :: new ( )
223
- . connect_timeout ( Duration :: from_secs ( 60 ) )
224
- . timeout ( Duration :: from_secs ( 60 ) )
207
+ . connect_timeout ( Duration :: from_secs ( 75 ) )
208
+ . timeout ( Duration :: from_secs ( 75 ) )
225
209
. build ( )
226
210
. unwrap ( ) ;
227
211
0 commit comments