This commit is contained in:
aozhiwei 2023-07-06 13:42:38 +08:00
parent 46c85f4ce0
commit 567a0cc278
2 changed files with 26 additions and 7 deletions

View File

@ -47,6 +47,9 @@ class DbEventProcess extends BaseService {
this.lastIdx = BigInt(0); this.lastIdx = BigInt(0);
this.eventConf = this.event['eventConf']; this.eventConf = this.event['eventConf'];
this.progInfo = this.event['progressInfo']; 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(); await this.start();
} }
@ -153,6 +156,10 @@ class DbEventProcess extends BaseService {
} }
} }
getMaxIdx() {
return 0;
}
} }
module.exports = DbEventProcess; module.exports = DbEventProcess;

View File

@ -28,12 +28,18 @@ class DbSpider extends BaseTask {
'progressInfo': { 'progressInfo': {
'pullCount': 0, 'pullCount': 0,
'eventCount': 0, 'eventCount': 0,
'lastIdx': 0, 'pullLastIdx': 0,
'maxIdx': 0 'pullMaxIdx': 0,
'procPullCount': 0,
'procEventCount': 0,
'procLastIdx': 0,
'procmaxIdx': 0
} }
}; };
events.push(event); events.push(event);
this.createPullDbEventService(net, event); this.createPullDbEventService(net, event);
this.createDbEventProcessService(net, event);
}); });
this.outputProgressInfo(net, events); this.outputProgressInfo(net, events);
} }
@ -47,7 +53,7 @@ class DbSpider extends BaseTask {
createDbEventProcessService(net, event) { createDbEventProcessService(net, event) {
const DbEventProcessService = serviceFactory.create('DbEventProcess'); const DbEventProcessService = serviceFactory.create('DbEventProcess');
event['DbEventProcessService'] = DbEventProcessService; event['dbEventProcessService'] = DbEventProcessService;
DbEventProcessService.init(net, event); DbEventProcessService.init(net, event);
return DbEventProcessService; return DbEventProcessService;
} }
@ -63,13 +69,19 @@ class DbSpider extends BaseTask {
const eventConf = event['eventConf']; const eventConf = event['eventConf'];
const progInfo = event['progressInfo']; const progInfo = event['progressInfo'];
const pullService = event['pullDbEventService']; const pullService = event['pullDbEventService'];
const procService = event['dbEventProcessService'];
const logObj = 'net_id: ' + net['net_id'] + ' ' + const logObj = 'net_id: ' + net['net_id'] + ' ' +
eventConf['contract_name'] + '.' + eventConf['contract_name'] + '.' +
eventConf['event_name'] + ' ' + eventConf['event_name'] + ' ' +
' pullCount:' + progInfo['pullCount'] + ' A_pullCount:' + progInfo['pullCount'] +
' eventCount:' + progInfo['eventCount'] + ' A_eventCount:' + progInfo['eventCount'] +
' lastIdx:' + progInfo['lastIdx'] + ' A_lastIdx:' + progInfo['pullLastIdx'] +
' maxIdx:' + pullService.getMaxIdx().toString() + ' 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); log.info(logObj);
} }