Skip to content

Commit

Permalink
allow to configure archive timeout and increase it to 180 seconds by …
Browse files Browse the repository at this point in the history
…default
  • Loading branch information
eldargab committed Aug 8, 2023
1 parent 11893f0 commit cc00d66
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@subsquid/evm-processor",
"comment": "allow to configure archive request timeout and increase the default up to 180 seconds",
"type": "minor"
}
],
"packageName": "@subsquid/evm-processor"
}
17 changes: 14 additions & 3 deletions evm/evm-processor/src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ type ChainRpc = string | {
}


type ArchiveConnection = string | {
url: string
requestTimeout?: number
}


interface ArchiveDataSource {
/**
* Subsquid evm archive endpoint URL
*/
archive: string
archive: ArchiveConnection
/**
* Chain node RPC endpoint URL
*/
Expand Down Expand Up @@ -298,15 +304,20 @@ export class EvmBatchProcessor<F extends FieldSelection = {}> {

@def
private getArchiveDataSource(): EvmArchive {
let archive = assertNotNull(this.getDataSource().archive)
if (typeof archive == 'string') {
archive = {url: archive}
}

let http = new HttpClient({
baseUrl: assertNotNull(this.getDataSource().archive),
baseUrl: archive.url,
headers: {
'x-squid-id': this.getSquidId()
},
agent: new HttpAgent({
keepAlive: true
}),
httpTimeout: 30_000,
httpTimeout: archive.requestTimeout || 180_000,
retryAttempts: Number.MAX_SAFE_INTEGER,
log: this.getLogger().child('archive')
})
Expand Down

0 comments on commit cc00d66

Please sign in to comment.