(keepStarted = false)
| 186 | } |
| 187 | |
| 188 | public async stop(keepStarted = false) { |
| 189 | if (!keepStarted) { |
| 190 | this.isStarted = false; |
| 191 | if (typeof window !== "undefined" && typeof document !== "undefined") { |
| 192 | document.removeEventListener("visibilitychange", this.handleVisibilityChange); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | if (this.visibilityDebounceTimer) { |
| 197 | clearTimeout(this.visibilityDebounceTimer); |
| 198 | this.visibilityDebounceTimer = null; |
| 199 | } |
| 200 | |
| 201 | const supabase = getSupabaseClient(); |
| 202 | |
| 203 | if (this.channel) { |
| 204 | console.log(`[KuzuCoordinator] Unsubscribing from query tunnel: ${this.channelName}`); |
| 205 | try { |
| 206 | await supabase.removeChannel(this.channel); |
| 207 | } catch { |
| 208 | /* ignore */ |
| 209 | } |
| 210 | this.channel = null; |
| 211 | } |
| 212 | |
| 213 | if (this.keepaliveInterval) { |
| 214 | clearInterval(this.keepaliveInterval); |
| 215 | this.keepaliveInterval = null; |
| 216 | } |
| 217 | } |
| 218 | } |
no test coverage detected