This commit is contained in:
aozhiwei 2023-07-11 16:09:28 +08:00
parent d0111af164
commit e70f0a5086
3 changed files with 34 additions and 2 deletions

View File

@ -218,7 +218,11 @@ class DbEventProcess extends BaseService {
return false;
}
const handle = eventsFactory.createEventHandle(this, this.conn, row);
await handle.start();
try {
await handle.start();
} finally {
await handle.safeRelease();
}
return true;
}

View File

@ -14,6 +14,17 @@ class BaseEventProcess {
this.conn = conn;
this.eventDb = eventDb;
this.returnValues = utils.jsonDecode(this.getEventDb()['return_values']);
this.bcEventConn = null;
this.bcNftConn = null;
this.gameConn = null;
}
async safeRelease() {
try {
} catch (err) {
}
}
genLogHead(msg) {
@ -130,6 +141,23 @@ class BaseEventProcess {
}
}
async bcEventDbConn(method, ...args) {
const conn = await this.getMarketDb();
const ret = await conn[method](...args);
if (ret.err){
this.throwError(500, 'internal error');
log.error(ret.err);
return;
}
if (utils.hasKey(ret, 'row')) {
return ret['row'];
} else if (utils.hasKey(ret, 'rows')) {
return ret['rows'];
} else {
return null;
}
}
}
module.exports = BaseEventProcess;

2
third_party/j7 vendored

@ -1 +1 @@
Subproject commit 22eef8b27c64e0970dc96e96496b51bffc42c7c8
Subproject commit ce576bd6ff46b5ce4836d786a7670f545916665f