From f06a1967a91dc3e4607cd4d3472677e928ff4f84 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 10 Jul 2023 15:19:38 +0800 Subject: [PATCH] 1 --- server/web3dbspider/services/dbevent_process.js | 4 ++-- server/web3dbspider/services/pull_dbevent.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/web3dbspider/services/dbevent_process.js b/server/web3dbspider/services/dbevent_process.js index 5707224..07fa836 100644 --- a/server/web3dbspider/services/dbevent_process.js +++ b/server/web3dbspider/services/dbevent_process.js @@ -12,7 +12,7 @@ class DbEventProcess extends BaseService { static #tableMaxIdxHash = {}; static async staticInit() { - const {err, conn} = await app.getDbConn('BcEventDb0'); + const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME); const tables = metaFactory.getAllTables(); await utils.serial ( @@ -49,7 +49,7 @@ class DbEventProcess extends BaseService { this.eventConf = this.event['eventConf']; this.progInfo = this.event['progressInfo']; 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.lastIdx = await this.getLastIdx(); this.progInfo['proclastIdx'] = this.lastIdx.toString(); diff --git a/server/web3dbspider/services/pull_dbevent.js b/server/web3dbspider/services/pull_dbevent.js index 70fdfec..1c69822 100644 --- a/server/web3dbspider/services/pull_dbevent.js +++ b/server/web3dbspider/services/pull_dbevent.js @@ -2,6 +2,7 @@ const app = require('j7/app'); const utils = require('j7/utils'); const bcutils = require('j7/bcutils'); const log = require('j7/log'); +const constant = require('common/constant'); const BaseService = require('./baseservice'); const LIMIT_COUNT = 100; @@ -12,7 +13,7 @@ class PullDbEvent extends BaseService { static #maxIdx = BigInt(0); 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); if (err) { @@ -35,7 +36,7 @@ class PullDbEvent extends BaseService { } async init(net, event) { - const {err, conn} = await app.getDbConn('BcEventDb0'); + const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME); this.conn = conn; this.net = net; this.event = event;