2050 Configured sendmail in dev / ci environments to return immediate…#2055
Open
2050 Configured sendmail in dev / ci environments to return immediate…#2055
Conversation
…ly instead of trying to send mail
Contributor
|
Very nice profiling to find out the bottleneck! But I do think it would be nice to check with logic wether mail is configured instead before sending an email. The thing is that it is not a requirement for a production setup to have mail configured, so then they will run into this bottleneck. Probably the easiest way would be to check the existence of the ssmtp.conf file. But if you can find another solution that would be good aswell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ly instead of trying to send mail
I did notice that the user creation was somewhat slow in my dev environment, a profile of the request gave
...
800,815,612 (95.49%) 2,152 ( 0.09%) /var/www/html/src/inc/Util.php:Hashtopolis\inc\Util::sendMail
800,811,639 (95.49%) 880 ( 0.04%) php:internal:php::mail
21,322,474 ( 2.54%) 296 ( 0.01%) /var/www/html/src/inc/Encryption.php:Hashtopolis\inc\Encryption::passwordHash
21,319,117 ( 2.54%) 96 ( 0.00%) php:internal:php::password_hash
7,164,671 ( 0.85%) 402,800 (16.43%) /var/www/html/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php:Slim\Middleware\RoutingMiddleware->performRouting
...
Which I interpret as lots of time is spent in php:internal:php::mail. Since I don't have any sendmail config in my environment I guess it tries with default config and traps waiting for something.
I guess that we don't see this in many production environments since most of them probably have mail configured correctly and then there is not much time taken for the send to complete.
About the fix, I took what I got from copilot, now we configure the environments (devcontainers and ci) to use /bin/true to simulate successful mail sending. I guess there are cases where we really would like the email to be sent and verified but that might be the exception and then will require some specific mail configuration to be done.
Profiling after the fix the send mail function is not noticed as significant enough to report (my guess) and the integration tests in
test_user.pyis faster to run, and my local setup of server / web-ui is runs with expected latency.