File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
packages/fasset-indexer-core/src Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ export class ConfigLoader {
7171 return minBlock == null ? undefined : parseInt ( minBlock )
7272 }
7373
74+ get logQueryBatchSize ( ) : number {
75+ const size = process . env . LOG_QUERY_BATCH_SIZE
76+ return size == null ? 28 : parseInt ( size )
77+ }
78+
7479 get indexPrices ( ) : boolean {
7580 return process . env . INDEX_PRICES === 'true'
7681 }
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ export const SLEEP_AFTER_ERROR_MS = 100
66export const EVM_LOG_FETCH_SLEEP_MS = 30 * 1000 // collect logs every 30 seconds
77export const EVM_STATE_UPDATE_SLEEP_MS = 60 * 1000 // collect state every one minute
88export const EVM_BLOCK_HEIGHT_OFFSET = 10 // log collection offset from the current block height
9- export const EVM_LOG_FETCH_SIZE = 30 // number of logs fetched from an evm chain (max is 30)
109
1110// db settings
1211export const MIN_DATABASE_POOL_CONNECTIONS = 2
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import { EventScraper } from './eventlib/event-scraper'
55import { logger } from '../logger'
66import {
77 FIRST_UNHANDLED_EVENT_BLOCK_DB_KEY ,
8- EVM_LOG_FETCH_SIZE ,
98 EVM_BLOCK_HEIGHT_OFFSET ,
109 MIN_EVM_BLOCK_NUMBER_DB_KEY
1110} from '../config/constants'
@@ -35,8 +34,8 @@ export class EventIndexer {
3534 if ( endBlock === undefined || endBlock > lastBlockToHandle ) {
3635 endBlock = lastBlockToHandle
3736 }
38- for ( let i = startBlock ; i <= endBlock ; i += EVM_LOG_FETCH_SIZE + 1 ) {
39- const endLoopBlock = Math . min ( endBlock , i + EVM_LOG_FETCH_SIZE )
37+ for ( let i = startBlock ; i <= endBlock ; i += this . context . config . logQueryBatchSize + 1 ) {
38+ const endLoopBlock = Math . min ( endBlock , i + this . context . config . logQueryBatchSize )
4039 const logs = await this . eventScraper . getLogs ( i , endLoopBlock )
4140 await this . storeLogs ( logs )
4241 await this . setFirstUnhandledBlock ( endLoopBlock + 1 )
You can’t perform that action at this time.
0 commit comments