File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ runProgram(async () => {
9595 return mainWorker . getStream ( req )
9696 }
9797 }
98-
98+ // dataSource = createDataSource(dataSourceOptions)
9999 let service = await runDataService ( {
100100 source : dataSource ,
101101 blockCacheSize : args . blockCacheSize ,
Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ export class Rpc {
621621 if ( batch . length <= 1 ) return this . batchCall ( batch , options )
622622
623623 let result = await this . batchCall ( batch , { ...options , retryAttempts : 0 } ) . catch ( err => {
624- if ( this . client . isConnectionError ( err ) || err instanceof RpcProtocolError ) {
624+ if ( this . isRetryableError ( err ) ) {
625625 this . log . warn ( err , 'will retry request with reduced batch' )
626626 } else {
627627 throw err
@@ -643,6 +643,14 @@ export class Rpc {
643643 let chainId : Qty = await this . call ( 'eth_chainId' )
644644 return this . chainUtils = new ChainUtils ( chainId )
645645 }
646+
647+ isRetryableError ( err : any ) : boolean {
648+ if ( this . client . isConnectionError ( err ) ) return true
649+ if ( err instanceof RpcProtocolError ) return true
650+ if ( err instanceof RpcError && err . message == 'response too large' ) return true
651+ if ( err instanceof RpcError && err . code == 429 ) return true
652+ return false
653+ }
646654}
647655
648656
Original file line number Diff line number Diff line change @@ -518,9 +518,6 @@ export class RpcClient {
518518 if ( err instanceof RpcConnectionError ) return true
519519 if ( isHttpConnectionError ( err ) ) return true
520520 if ( err instanceof HttpTimeoutError ) return true
521- if ( err instanceof RpcError ) {
522- return err . code == 429
523- }
524521 if ( err instanceof HttpError ) {
525522 switch ( err . response . status ) {
526523 case 408 :
@@ -594,6 +591,7 @@ function isExecutionTimeoutError(err: unknown): boolean {
594591 return err instanceof RpcError && / e x e c u t i o n t i m e o u t / i. test ( err . message )
595592}
596593
594+
597595function isRequestTimedOutError ( err : unknown ) : boolean {
598596 return err instanceof RpcError && / r e q u e s t .* t i m e d o u t / i. test ( err . message )
599597}
You can’t perform that action at this time.
0 commit comments