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