mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 13:53:59 +00:00
imrpoved closing inactive sessions
This commit is contained in:
@@ -105,6 +105,8 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
subprocess.on('exit', () => {
|
subprocess.on('exit', () => {
|
||||||
this.opened = this.opened.filter(x => x.sesid != sesid);
|
this.opened = this.opened.filter(x => x.sesid != sesid);
|
||||||
|
this.dispatchMessage(sesid, 'Query session closed');
|
||||||
|
socket.emit(`session-closed-${sesid}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
subprocess.send({ msgtype: 'connect', ...connection, database });
|
subprocess.send({ msgtype: 'connect', ...connection, database });
|
||||||
|
|||||||
@@ -80,8 +80,10 @@
|
|||||||
function onSession(sid) {
|
function onSession(sid) {
|
||||||
if (sid) {
|
if (sid) {
|
||||||
apiOn(`session-done-${sid}`, handleSessionDone);
|
apiOn(`session-done-${sid}`, handleSessionDone);
|
||||||
|
apiOn(`session-closed-${sid}`, handleSessionClosed);
|
||||||
return () => {
|
return () => {
|
||||||
apiOff(`session-done-${sid}`, handleSessionDone);
|
apiOff(`session-done-${sid}`, handleSessionDone);
|
||||||
|
apiOff(`session-closed-${sid}`, handleSessionClosed);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return () => {};
|
return () => {};
|
||||||
@@ -197,6 +199,11 @@
|
|||||||
timerLabel.stop();
|
timerLabel.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSessionClosed = () => {
|
||||||
|
sessionId = null;
|
||||||
|
handleSessionDone();
|
||||||
|
};
|
||||||
|
|
||||||
const handleChange = (value, skipUndoChain) =>
|
const handleChange = (value, skipUndoChain) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
dispatchModel({
|
dispatchModel({
|
||||||
|
|||||||
@@ -125,8 +125,10 @@
|
|||||||
function onSession(sid) {
|
function onSession(sid) {
|
||||||
if (sid) {
|
if (sid) {
|
||||||
apiOn(`session-done-${sid}`, handleSessionDone);
|
apiOn(`session-done-${sid}`, handleSessionDone);
|
||||||
|
apiOn(`session-closed-${sid}`, handleSessionClosed);
|
||||||
return () => {
|
return () => {
|
||||||
apiOff(`session-done-${sid}`, handleSessionDone);
|
apiOff(`session-done-${sid}`, handleSessionDone);
|
||||||
|
apiOff(`session-closed-${sid}`, handleSessionClosed);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return () => {};
|
return () => {};
|
||||||
@@ -279,6 +281,11 @@
|
|||||||
timerLabel.stop();
|
timerLabel.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSessionClosed = () => {
|
||||||
|
sessionId = null;
|
||||||
|
handleSessionDone();
|
||||||
|
};
|
||||||
|
|
||||||
const { editorState, editorValue, setEditorData } = useEditorData({
|
const { editorState, editorValue, setEditorData } = useEditorData({
|
||||||
tabid,
|
tabid,
|
||||||
loadFromArgs:
|
loadFromArgs:
|
||||||
|
|||||||
Reference in New Issue
Block a user