Hello, I'm trying to make consecutive connections but when an connection attempt fails (e.g. by autentication fail) the next connections throw an ConnectionTimeoutError:. Is there any way to handle this problem? I think that its caused by consecutives attempts to connect the failed connection that throws the error. Can I close or clean the stack of connections? thanks for your help.
P.D. Sorry for my English.
My current code is something like this:
console.log("=== START ===");
for(const user of users)
{
await imaps.connect(user.config).then(connection =>
{
console.log("[INFO] IMAP connection established to the account "+user.config.imap.user);
return connection.openBox('INBOX').then(() =>
{
//Do something
connection.end()
})
.catch(error =>
{
console.log("[ERROR] "+error);
connection.end()
return
})
}
.catch(error =>
{
console.log("[ERROR] "+error+" email: "+user.config.imap.user);
//I think than i have to close the connection that throw the error here
});
}
console.log("=== END ===");
So, i get a similar logs than next:
=== START ===
[INFO] IMAP connection established to the account user@mail.com
[ERROR] Error: Authentication failed. email: user2@mail.com
[ERROR] ConnectionTimeoutError: connection timed out. timeout = 2000 ms email: user3@mail.com
[ERROR] ConnectionTimeoutError: connection timed out. timeout = 2000 ms email: user4@mail.com
[ERROR] ConnectionTimeoutError: connection timed out. timeout = 2000 ms email: user5@mail.com
=== END ===
Hello, I'm trying to make consecutive connections but when an connection attempt fails (e.g. by autentication fail) the next connections throw an ConnectionTimeoutError:. Is there any way to handle this problem? I think that its caused by consecutives attempts to connect the failed connection that throws the error. Can I close or clean the stack of connections? thanks for your help. P.D. Sorry for my English.
My current code is something like this:
So, i get a similar logs than next: