nodemailer / smtp-server

Create custom SMTP servers on the fly
Other
846 stars 146 forks source link

`connectionTimeout: 0` does not work #105

Closed artemave closed 6 years ago

artemave commented 6 years ago

Because it evaluates to false here:

let timeout = this.options.closeTimeout || CLOSE_TIMEOUT;
andris9 commented 6 years ago

Why would you want to use 0 as timeout?

artemave commented 6 years ago

We use smtp-server in tests as a simulator. We want it to shut down asap between tests so that tests don't get slow.

andris9 commented 6 years ago

Due to how timers in JavaScript work you would not get any noticeable performance gain when using 0 instead of 1.

artemave commented 6 years ago

The problem is not that 1 is greater than 0, it's that when you want to disable timeout and you'd set it to 0, it would turn out to be 300. That is a bug.