try to fix e_channel_closed error

This commit is contained in:
Jan Prochazka
2023-09-30 12:29:28 +02:00
parent 731c4c046c
commit ce09fcb7fd
3 changed files with 22 additions and 3 deletions

View File

@@ -292,7 +292,17 @@ module.exports = {
let existing = this.opened.find(x => x.conid == conid && x.database == database);
if (existing) {
existing.subprocess.send({ msgtype: 'ping' });
try {
existing.subprocess.send({ msgtype: 'ping' });
} catch (err) {
logger.error({ err }, 'Error pinging DB connection');
this.close(conid, database);
return {
status: 'error',
message: 'Ping failed',
};
}
} else {
// @ts-ignore
existing = await this.ensureOpened(conid, database);