This commit is contained in:
aozhiwei 2023-07-11 18:07:14 +08:00
parent bfee2f5bcf
commit a98da690a7

View File

@ -158,18 +158,27 @@ class BaseEventProcess {
} }
async bcEventDbConn(method, ...args) { async bcEventDbConn(method, ...args) {
const conn = await this.recreateConn('bcEventConn', constant.BCEVENTDB_NAME); const ret = await this.recreateConn('bcEventConn', constant.BCEVENTDB_NAME);
return await this.internalDbConn(conn, method, ...args); if (ret.err) {
return ret;
}
return await this.internalDbConn(ret.conn, method, ...args);
} }
async bcNftDbConn(method, ...args) { async bcNftDbConn(method, ...args) {
const conn = await this.recreateConn('bcNftConn', constant.BCNFTDB_NAME); const ret = await this.recreateConn('bcNftConn', constant.BCNFTDB_NAME);
return await this.internalDbConn(conn, method, ...args); if (ret.err) {
return ret;
}
return await this.internalDbConn(ret.conn, method, ...args);
} }
async gameDbConn(method, ...args) { async gameDbConn(method, ...args) {
const conn = await this.recreateConn('gameConn', constant.GAMEDB_NAME); const ret = await this.recreateConn('gameConn', constant.GAMEDB_NAME);
return await this.internalDbConn(conn, method, ...args); if (ret.err) {
return ret;
}
return await this.internalDbConn(ret.conn, method, ...args);
} }
async recreateConn(connName, dbName) { async recreateConn(connName, dbName) {
@ -178,13 +187,17 @@ class BaseEventProcess {
if (err) { if (err) {
return { return {
'err': err, 'err': err,
'conn': null,
'row': null, 'row': null,
'rows': null 'rows': null
}; };
} }
this[connName] = conn; this[connName] = conn;
} }
return this[connName]; return {
'err': null,
'conn': this[connName]
};
} }
async internalDbConn(conn, method, ...args) { async internalDbConn(conn, method, ...args) {