mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 15:36:28 +00:00
try to fix e_channel_closed error
This commit is contained in:
@@ -292,7 +292,17 @@ module.exports = {
|
|||||||
let existing = this.opened.find(x => x.conid == conid && x.database == database);
|
let existing = this.opened.find(x => x.conid == conid && x.database == database);
|
||||||
|
|
||||||
if (existing) {
|
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 {
|
} else {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
existing = await this.ensureOpened(conid, database);
|
existing = await this.ensureOpened(conid, database);
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
opened.subprocess.send({ msgtype: 'ping' });
|
opened.subprocess.send({ msgtype: 'ping' });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error({ err }, 'Error calling ping');
|
logger.error({ err }, 'Error pinging server connection');
|
||||||
this.close(conid);
|
this.close(conid);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -219,7 +219,16 @@ module.exports = {
|
|||||||
if (!session) {
|
if (!session) {
|
||||||
throw new Error('Invalid session');
|
throw new Error('Invalid session');
|
||||||
}
|
}
|
||||||
session.subprocess.send({ msgtype: 'ping' });
|
try {
|
||||||
|
session.subprocess.send({ msgtype: 'ping' });
|
||||||
|
} catch (err) {
|
||||||
|
logger.error({ err }, 'Error pinging session');
|
||||||
|
|
||||||
|
return {
|
||||||
|
status: 'error',
|
||||||
|
message: 'Ping failed',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return { state: 'ok' };
|
return { state: 'ok' };
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user