mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +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 (adminSocketSessions[peer.id] === undefined) return;
|
||||
delete adminSocketSessions[peer.id];
|
||||
|
||||
taskHandler.disconnectAll(peer.id);
|
||||
},
|
||||
});
|
||||
|
||||
@ -111,6 +111,14 @@ class TaskHandler {
|
||||
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) {
|
||||
if (!this.taskRegistry[taskId]) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user