Added mutex + fixed rare duplicate chats bug + fixed connect bug

The mutex will prevent duplicate functions from being called and throwing funky errors.
This commit is contained in:
Adhiraj
2020-09-09 14:16:08 +05:30
parent 6e22ceac98
commit 6d2eaf93cb
11 changed files with 211 additions and 25 deletions

View File

@@ -55,7 +55,7 @@ export class WAConnection extends EventEmitter {
/** Whether the phone is connected */
phoneConnected: boolean = false
maxCachedMessages = 25
maxCachedMessages = 50
chats: KeyedDB<WAChat> = new KeyedDB (Utils.waChatUniqueKey, value => value.jid)
contacts: { [k: string]: WAContact } = {}