Closed chillmati closed 3 years ago
Are you checking that the connection is usable before calling getEmails()
/mailbox.openBox()
? I'm guessing either the connection was lost or you attempted to reconnect and tried to use the API before authentication finished.
I wasn't. Managed to fix it with your suggestion, thanks!
async init() {
mailbox.once('ready', () => {
this.interval = setInterval(this.getEmails, 2000)
})
mailbox.connect()
}
async openInbox(callback) {
if (mailbox.state === 'authenticated') {
mailbox.openBox('INBOX', false, callback)
} else {
mailbox.destroy()
clearInterval(this.interval)
mailbox.once('close', () => {
log.notify(`[CONNECT] Authenticating ${mailbox.state}`)
this.init()
})
}
}
Hello, I'm getting this error after running my script.
My script is suppose to check mailbox every 2 second for new emails. It happens when the script is running for a while. How can I prevent it from happening?