mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
better cleanup
This commit is contained in:
@@ -130,8 +130,10 @@ export const openWebSocketConnection = (timeoutMs: number, retryOnNetworkError:
|
||||
while (!cancelled) {
|
||||
try {
|
||||
const ws = await newWS()
|
||||
if (!cancelled) return ws
|
||||
break
|
||||
if (cancelled) {
|
||||
ws.close ()
|
||||
break
|
||||
} else return ws
|
||||
} catch (error) {
|
||||
if (!retryOnNetworkError) throw error
|
||||
await delay (1000)
|
||||
|
||||
Reference in New Issue
Block a user