File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -644,13 +644,18 @@ export function createGatewayRuntime<
644644 const uplinksToUse : string [ ] = [ ] ;
645645 let retries = opts . maxRetries || Math . max ( 3 , uplinks . length ) ;
646646 const fetchSupergraphWithDelay = ( ) : MaybePromise < string > => {
647- const currentTime = Date . now ( ) ;
648- if ( nextFetchTime >= currentTime ) {
649- const delay = nextFetchTime - currentTime ;
650- graphosLogger . info ( `Fetching supergraph with delay: ${ delay } ms` ) ;
651- return new Promise ( ( resolve ) =>
652- setTimeout ( ( ) => resolve ( fetchSupergraph ( ) ) , delay ) ,
653- ) ;
647+ if ( nextFetchTime ) {
648+ const currentTime = Date . now ( ) ;
649+ if ( nextFetchTime >= currentTime ) {
650+ const delay = nextFetchTime - currentTime ;
651+ graphosLogger . info ( `Fetching supergraph with delay: ${ delay } ms` ) ;
652+ return new Promise ( ( resolve ) =>
653+ setTimeout ( ( ) => {
654+ nextFetchTime = 0 ;
655+ resolve ( fetchSupergraph ( ) ) ;
656+ } , delay ) ,
657+ ) ;
658+ }
654659 }
655660 return fetchSupergraph ( ) ;
656661 } ;
You can’t perform that action at this time.
0 commit comments