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.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;

View File

@ -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);
}