Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useless callback parameter in Mailin.prototype.start #109

Open
shivanshu3 opened this issue Oct 6, 2016 · 1 comment
Open

Useless callback parameter in Mailin.prototype.start #109

shivanshu3 opened this issue Oct 6, 2016 · 1 comment

Comments

@shivanshu3
Copy link

Ideally this callback should be called after the SMTP server has started listening, specifically right after this line:
logger.info('Mailin Smtp server listening on port ' + configuration.port);

Right now it only gets called if there was an error in server.listen, which is OK.
The other place when it gets called is at the very end of the Mailin.prototype.start function, which is useless.

@gmeurant
Copy link

gmeurant commented Nov 3, 2020

I was having a hard time wrapping the server start/stop in beforeAll/afterAll methods in a Jest test, until I found this comment.

Indeed, the callback is called after the prototype is finished, not after the smtp server has effectively started.

In my case, the server is in the process of starting when the test starts, then the test finishes, then it tries to stop the server, but as it has not finished started yet, nothing happens, then the Smtp server finally is started : the test process never stops !

If I move the callback call just after the line you mentioned, it works great.

Is the current behaviour intended ?? or is it a bug ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants