mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Prevent unexpected endConnection
This commit is contained in:
@@ -96,7 +96,7 @@ export class WAConnection extends EventEmitter {
|
||||
protected mediaConn: MediaConnInfo
|
||||
protected connectionDebounceTimeout = Utils.debouncedTimeout(
|
||||
1000,
|
||||
() => this.endConnection(DisconnectReason.timedOut)
|
||||
() => this.state === 'connecting' && this.endConnection(DisconnectReason.timedOut)
|
||||
)
|
||||
protected messagesDebounceTimeout = Utils.debouncedTimeout(2000)
|
||||
/**
|
||||
|
||||
@@ -225,7 +225,8 @@ export class WAConnection extends Base {
|
||||
ref = newRef
|
||||
} catch (error) {
|
||||
this.logger.warn ({ error }, `error in QR gen`)
|
||||
if (error.status === 429) { // too many QR requests
|
||||
// @ts-ignore
|
||||
if (error.status === 429 && this.state !== 'open') { // too many QR requests
|
||||
this.endConnection(error.message)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user