From 567a0cc278509546d8a55fc64144156020ac811a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 6 Jul 2023 13:42:38 +0800 Subject: [PATCH] 1 --- .../web3dbspider/services/dbevent_process.js | 7 +++++ server/web3dbspider/tasks/dbspider.js | 26 ++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/server/web3dbspider/services/dbevent_process.js b/server/web3dbspider/services/dbevent_process.js index 55aec1b..c29809b 100644 --- a/server/web3dbspider/services/dbevent_process.js +++ b/server/web3dbspider/services/dbevent_process.js @@ -47,6 +47,9 @@ class DbEventProcess extends BaseService { this.lastIdx = BigInt(0); this.eventConf = this.event['eventConf']; this.progInfo = this.event['progressInfo']; + this.contractAddress = this.net.getContractAddressByName(this.getContractName()); + this.lastIdx = await this.getLastIdx(); + this.progInfo['lastIdx'] = this.lastIdx.toString(); await this.start(); } @@ -153,6 +156,10 @@ class DbEventProcess extends BaseService { } } + getMaxIdx() { + return 0; + } + } module.exports = DbEventProcess; diff --git a/server/web3dbspider/tasks/dbspider.js b/server/web3dbspider/tasks/dbspider.js index 89afb29..e0fd616 100644 --- a/server/web3dbspider/tasks/dbspider.js +++ b/server/web3dbspider/tasks/dbspider.js @@ -28,12 +28,18 @@ class DbSpider extends BaseTask { 'progressInfo': { 'pullCount': 0, 'eventCount': 0, - 'lastIdx': 0, - 'maxIdx': 0 + 'pullLastIdx': 0, + 'pullMaxIdx': 0, + + 'procPullCount': 0, + 'procEventCount': 0, + 'procLastIdx': 0, + 'procmaxIdx': 0 } }; events.push(event); this.createPullDbEventService(net, event); + this.createDbEventProcessService(net, event); }); this.outputProgressInfo(net, events); } @@ -47,7 +53,7 @@ class DbSpider extends BaseTask { createDbEventProcessService(net, event) { const DbEventProcessService = serviceFactory.create('DbEventProcess'); - event['DbEventProcessService'] = DbEventProcessService; + event['dbEventProcessService'] = DbEventProcessService; DbEventProcessService.init(net, event); return DbEventProcessService; } @@ -63,13 +69,19 @@ class DbSpider extends BaseTask { const eventConf = event['eventConf']; const progInfo = event['progressInfo']; const pullService = event['pullDbEventService']; + const procService = event['dbEventProcessService']; const logObj = 'net_id: ' + net['net_id'] + ' ' + eventConf['contract_name'] + '.' + eventConf['event_name'] + ' ' + - ' pullCount:' + progInfo['pullCount'] + - ' eventCount:' + progInfo['eventCount'] + - ' lastIdx:' + progInfo['lastIdx'] + - ' maxIdx:' + pullService.getMaxIdx().toString() + + ' A_pullCount:' + progInfo['pullCount'] + + ' A_eventCount:' + progInfo['eventCount'] + + ' A_lastIdx:' + progInfo['pullLastIdx'] + + ' A_maxIdx:' + pullService.getMaxIdx().toString() + + + ' B_pullCount:' + progInfo['procPullCount'] + + ' B_eventCount:' + progInfo['procEventCount'] + + ' B_lastIdx:' + progInfo['procLastIdx'] + + ' B_maxIdx:' + procService.getMaxIdx().toString() + ''; log.info(logObj); }