mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-15 01:01:20 +10:00
fix: properly disconnect websockets from task handler
This commit is contained in:
@ -48,5 +48,7 @@ export default defineWebSocketHandler({
|
|||||||
if (!peer.id) return;
|
if (!peer.id) return;
|
||||||
if (adminSocketSessions[peer.id] === undefined) return;
|
if (adminSocketSessions[peer.id] === undefined) return;
|
||||||
delete adminSocketSessions[peer.id];
|
delete adminSocketSessions[peer.id];
|
||||||
|
|
||||||
|
taskHandler.disconnectAll(peer.id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -111,6 +111,14 @@ class TaskHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnectAll(id: string) {
|
||||||
|
for (const [taskId] of Object.keys(this.taskRegistry)) {
|
||||||
|
delete this.taskRegistry[taskId].clients[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
delete this.clientRegistry[id];
|
||||||
|
}
|
||||||
|
|
||||||
disconnect(id: string, taskId: string) {
|
disconnect(id: string, taskId: string) {
|
||||||
if (!this.taskRegistry[taskId]) return false;
|
if (!this.taskRegistry[taskId]) return false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user