Dispose ALL sessions for a workspace (DELETE /workspaces/:id).
(wsId: string, reason: string)
| 181 | |
| 182 | /** Dispose ALL sessions for a workspace (DELETE /workspaces/:id). */ |
| 183 | dispose(wsId: string, reason: string): boolean { |
| 184 | const ids = this.byWs.get(wsId); |
| 185 | if (!ids || ids.size === 0) return false; |
| 186 | // Copy first — session.dispose() triggers onDisposed which mutates byWs. |
| 187 | const snapshot = Array.from(ids); |
| 188 | for (const id of snapshot) { |
| 189 | const s = this.sessions.get(id); |
| 190 | if (s) s.dispose(reason); |
| 191 | } |
| 192 | return true; |
| 193 | } |
| 194 | |
| 195 | disposeAll(reason: string): void { |
| 196 | for (const session of Array.from(this.sessions.values())) { |