This commit is contained in:
aozhiwei 2023-07-13 15:48:17 +08:00
parent 4bf1275386
commit df58373bf5

View File

@ -3,6 +3,7 @@ const utils = require('j7/utils');
const bcutils = require('j7/bcutils');
const log = require('j7/log');
const constant = require('common/constant');
const dbpool = require('common/dbpool');
const BaseService = require('./baseservice');
const LIMIT_COUNT = 100;
@ -10,8 +11,6 @@ const LIMIT_COUNT = 100;
class Erc721Refresher extends BaseService {
async init(bc, net, refresher) {
const {err, conn} = await app.getDbConn(constant.BCEVENTDB_NAME);
this.conn = conn;
this.bc = bc;
this.net = net;
this.refresher = refresher;
@ -31,8 +30,10 @@ class Erc721Refresher extends BaseService {
async pullEvent() {
const logHead = this.genLogHead('pullEvent ');
try {
const {err, rows} = await this.conn.execQuery(
'SELECT * FROM t_erc721_refresh WHERE idx > ' + this.lastIdx.toString() + ' ' +
const {err, rows} = await dbpool.getBcEventConn(
app,
'execQuery',
',SELECT * FROM t_erc721_refresh WHERE idx > ' + this.lastIdx.toString() + ' ' +
'AND net_id = ? AND contract_address = ? AND status = 0 ' +
'LIMIT ' + LIMIT_COUNT,
[
@ -207,7 +208,9 @@ class Erc721Refresher extends BaseService {
}
async update(row, fields) {
const {err} = await this.conn.update(
const {err} = await this.dbpool.getBcEventConn(
app,
'update',
't_erc721_refresh',
[
['idx', row['idx']],