1
This commit is contained in:
parent
ce0a246f74
commit
d6ff05a27c
@ -47,8 +47,13 @@ class Erc721Refresher extends BaseService {
|
||||
await utils.serial(
|
||||
rows,
|
||||
async (row) => {
|
||||
const nftExists = await this.tokenIsExists(row);
|
||||
if (nftExists) {
|
||||
await this.refresh(row);
|
||||
--this.progInfo['pendingCount'];
|
||||
} else {
|
||||
++this.progInfo['skipCount'];
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
@ -56,6 +61,7 @@ class Erc721Refresher extends BaseService {
|
||||
}
|
||||
++this.progInfo['refreshedCount'];
|
||||
this.progInfo['pendingCount'] = 0;
|
||||
this.progInfo['skipCount'] = 0;
|
||||
} catch (err) {
|
||||
log.error(logHead + err);
|
||||
await utils.sleep(5000 + utils.randRange(1000, 3000));
|
||||
@ -141,6 +147,35 @@ class Erc721Refresher extends BaseService {
|
||||
return true;
|
||||
}
|
||||
|
||||
async tokenIsExists(rawRow) {
|
||||
const {err, nftDbConn} = await app.getDbConn(constant.BCNFTDB_NAME);
|
||||
if (err) {
|
||||
log.error('updateConfirmed:' + this.tokenId + ' err:' + err);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
{
|
||||
const {err, row} = await nftDbConn.ormSelectOne(
|
||||
't_nft',
|
||||
[
|
||||
['net_id', rawRow['net_id']],
|
||||
['token_id', rawRow['token_id']],
|
||||
['contract_address', rawRow['contract_address']],
|
||||
]);
|
||||
if (err) {
|
||||
log.error('updateConfirmed:' + this.tokenId + ' err:' + err);
|
||||
return false;
|
||||
}
|
||||
if (row) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
nftDbConn.release();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async update(row, fields) {
|
||||
const {err} = await this.conn.update(
|
||||
't_erc721_refresh',
|
||||
|
@ -29,6 +29,7 @@ class BcRefresh extends BaseTask {
|
||||
'progressInfo': {
|
||||
'refreshedCount': 0,
|
||||
'pendingCount': 0,
|
||||
'skipCount': 0,
|
||||
}
|
||||
};
|
||||
refreshers.push(refresher);
|
||||
@ -116,7 +117,8 @@ class BcRefresh extends BaseTask {
|
||||
const logObj = 'net_id: ' + net['net_id'] + ' ' +
|
||||
conf['contract_name'] + '' +
|
||||
' refreshedCount:' + progInfo['refreshedCount'] +
|
||||
' pendingCount:' + progInfo['pendingCount']
|
||||
' pendingCount:' + progInfo['pendingCount'] +
|
||||
' skipCount:' + progInfo['skipCount']
|
||||
;
|
||||
log.info(logObj);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user