@@ -21,7 +21,6 @@ import { MockttpPluginOptions } from '../admin/mockttp-admin-plugin';
2121import { AdminPlugin , PluginClientResponsesMap , PluginStartParamsMap } from '../admin/admin-plugin-types' ;
2222import { SchemaIntrospector } from './schema-introspection' ;
2323import { AdminQuery , getSingleSelectedFieldName } from './admin-query' ;
24- import { MockttpOptions } from '../mockttp' ;
2524
2625const { fetch, Headers } = isNode || typeof globalThis . fetch === 'undefined'
2726 ? CrossFetch
@@ -223,7 +222,7 @@ export class AdminClient<Plugins extends { [key: string]: AdminPlugin<any, any>
223222 this . debug = ! ! options . debug ;
224223 this . adminClientOptions = _ . defaults ( options , {
225224 adminServerUrl : `http://localhost:${ DEFAULT_ADMIN_SERVER_PORT } ` ,
226- adminStreamReconnectAttempts : 5
225+ adminStreamReconnectAttempts : 8
227226 } ) ;
228227 }
229228
@@ -309,9 +308,8 @@ export class AdminClient<Plugins extends { [key: string]: AdminPlugin<any, any>
309308 if ( retries > 0 ) {
310309 // We delay re-retrying briefly - this helps to handle cases like the computer going
311310 // to sleep (where the server & client pause in parallel, but race to do so).
312- // The delay increases exponentially with retry attempts (10ms, 50, 250, 1250, 6250)
313311 const retryAttempt = this . adminClientOptions . adminStreamReconnectAttempts - retries ;
314- await delay ( 10 * Math . pow ( 5 , retryAttempt ) ) ;
312+ await delay ( Math . min ( 25 * Math . pow ( 2 , retryAttempt ) , 2_000 ) ) ;
315313
316314 return this . tryToReconnectStream ( adminSessionBaseUrl , targetStream , retries - 1 ) ;
317315 }
0 commit comments