We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 663546a commit 48a68e6Copy full SHA for 48a68e6
packages/opencode/src/share/share-next.ts
@@ -85,11 +85,12 @@ export namespace ShareNext {
85
log.error("failed to unsubscribe", { error })
86
}
87
88
- // Clear pending timeouts
89
- for (const entry of queue.values()) {
+ // Hardened: snapshot and clear atomically to avoid race during iteration
+ const pending = Array.from(queue.values())
90
+ queue.clear()
91
+ for (const entry of pending) {
92
clearTimeout(entry.timeout)
93
- queue.clear()
94
log.info("disposed share-next subscriptions")
95
96
0 commit comments