This commit is contained in:
aozhiwei 2023-07-12 20:41:53 +08:00
parent b846141d7f
commit f623f77e1b

View File

@ -47,7 +47,7 @@ class PullBcEvent extends BaseService {
}
async pullEvent() {
const logHead = this.getInstanceName() + ' pullEvent: ';
const logHead = this.genLogHead(' pullEvent: ');
while (true) {
await this.bc.lockQuery();
try {
@ -103,7 +103,7 @@ class PullBcEvent extends BaseService {
}
async getFromBlock() {
const logHead = this.getInstanceName() + ' getFromBlock: ';
const logHead = this.genLogHead(' getFromBlock: ');
const firstBlockNumber = this.getInitBlock();
while (this.lastBlockNumber < 1) {
try {
@ -151,7 +151,7 @@ class PullBcEvent extends BaseService {
}
async saveLastBlockNumber(blockNumber) {
const logHead = this.getInstanceName() + ' event_process.saveLastBlockNumber: ';
const logHead = this.genLogHead(' event_process.saveLastBlockNumber: ');
while (true) {
const {err} = await this.conn.upsert(
't_last_block',
@ -184,7 +184,7 @@ class PullBcEvent extends BaseService {
}
async saveToDb(event) {
const logHead = this.getInstanceName() + ' event_process.saveToDb: ';
const logHead = this.genLogHead(' event_process.saveToDb: ');
while (true) {
const nowTime = utils.getUtcTime();
const returnValues = event['returnValues'];
@ -247,9 +247,10 @@ class PullBcEvent extends BaseService {
return this.eventConf['contract_name'];
}
getInstanceName() {
const instName = this.getNetId() + '.' + this.getContractName() + '.' + this.getEventName();
return instName;
genLogHead(msg) {
const logHead = this.getNetId() + ' ' + this.getContractName() + '.' +
this.getEventName() + ' pull_bcevent ' + msg;
return logHead;
}
}