This commit is contained in:
aozhiwei 2023-07-05 19:41:03 +08:00
parent a929459db1
commit aa3863aeec
2 changed files with 11 additions and 1 deletions

View File

@ -43,6 +43,7 @@ class PullDbEvent extends BaseService {
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.contractAddress = this.net.getContractAddressByName(this.getContractName());
this.progInfo['lastIdx'] = this.lastIdx.toString();
await this.start(); await this.start();
} }
@ -199,6 +200,10 @@ class PullDbEvent extends BaseService {
} }
} }
getMaxIdx() {
return PullDbEvent.#maxIdx;
}
} }
module.exports = PullDbEvent; module.exports = PullDbEvent;

View File

@ -27,7 +27,9 @@ class DbSpider extends BaseTask {
'eventConf': eventConf, 'eventConf': eventConf,
'progressInfo': { 'progressInfo': {
'pullCount': 0, 'pullCount': 0,
'eventCount': 0 'eventCount': 0,
'lastIdx': 0,
'maxIdx': 0
} }
}; };
events.push(event); events.push(event);
@ -59,11 +61,14 @@ class DbSpider extends BaseTask {
(event) => { (event) => {
const eventConf = event['eventConf']; const eventConf = event['eventConf'];
const progInfo = event['progressInfo']; const progInfo = event['progressInfo'];
const pullService = event['pullDbEventService'];
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'] + ' pullCount:' + progInfo['pullCount'] +
' eventCount:' + progInfo['eventCount'] + ' eventCount:' + progInfo['eventCount'] +
' lastIdx:' + progInfo['lastIdx'] +
' maxIdx:' + pullService.getMaxIdx().toString() +
''; '';
log.info(logObj); log.info(logObj);
} }