emailjs / emailjs-imap-client

Low-level JS IMAP client for all your IMAP needs.
MIT License
553 stars 122 forks source link

Could not connect to server Error: Too many simultaneous connections. #207

Closed ztipnis closed 5 years ago

ztipnis commented 5 years ago

Have a web API using node/express which fetches data from an IMAP server. Each request follows the form:

imap.connect().then(async () => {
            await imap.[command[
            res.end([response]);
            await imap.destroy()
        });

imap.destroy:

    async destroy(){
        await this.client.logout();
        await this.client.close();
        this.client = undefined;
    }

this.client is an instance of ImapClient which is created during the constructor for the object.

After a few calls to the API I get:

Could not connect to server Error: Too many simultaneous connections.

felixhammerl commented 5 years ago

The client is not waiting to terminate the connection and the IMAP roundtrip takes a while. So if you're running them without a pause, that's the reason why it does not work.