This commit is contained in:
aozhiwei 2023-07-10 15:19:38 +08:00
parent 923bfc21b8
commit f06a1967a9
2 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,7 @@ class DbEventProcess extends BaseService {
static #tableMaxIdxHash = {}; static #tableMaxIdxHash = {};
static async staticInit() { static async staticInit() {
const {err, conn} = await app.getDbConn('BcEventDb0'); const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME);
const tables = metaFactory.getAllTables(); const tables = metaFactory.getAllTables();
await utils.serial await utils.serial
( (
@ -49,7 +49,7 @@ class DbEventProcess 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());
const {err, conn} = await app.getDbConn('BcEventDb0'); const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME);
this.conn = conn; this.conn = conn;
this.lastIdx = await this.getLastIdx(); this.lastIdx = await this.getLastIdx();
this.progInfo['proclastIdx'] = this.lastIdx.toString(); this.progInfo['proclastIdx'] = this.lastIdx.toString();

View File

@ -2,6 +2,7 @@ const app = require('j7/app');
const utils = require('j7/utils'); const utils = require('j7/utils');
const bcutils = require('j7/bcutils'); const bcutils = require('j7/bcutils');
const log = require('j7/log'); const log = require('j7/log');
const constant = require('common/constant');
const BaseService = require('./baseservice'); const BaseService = require('./baseservice');
const LIMIT_COUNT = 100; const LIMIT_COUNT = 100;
@ -12,7 +13,7 @@ class PullDbEvent extends BaseService {
static #maxIdx = BigInt(0); static #maxIdx = BigInt(0);
static async staticInit() { static async staticInit() {
const {err, conn} = await app.getDbConn('BcEventDb0'); const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME);
{ {
const {err, maxIdx} = await conn.getMaxIdx(BCEVENT_TABLE_NAME); const {err, maxIdx} = await conn.getMaxIdx(BCEVENT_TABLE_NAME);
if (err) { if (err) {
@ -35,7 +36,7 @@ class PullDbEvent extends BaseService {
} }
async init(net, event) { async init(net, event) {
const {err, conn} = await app.getDbConn('BcEventDb0'); const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME);
this.conn = conn; this.conn = conn;
this.net = net; this.net = net;
this.event = event; this.event = event;