Repository navigation
fix(messenger): configurable SMTP timeout (#278) - #203
Merged
Merged
Conversation
The SMTP send timeout was hardcoded at 30 s (_smtp_open(timeout=30)) with no constructor argument or environment key, so a host that accepts the connection then goes silent held the worker for the full 30 s - and on a server with few workers that stalls everyone else. Add a `timeout` constructor argument and a TINA4_MAIL_TIMEOUT env (SMTP_TIMEOUT fallback), default 30 (unchanged), used on the send path. The 10 s capability check is left as the fast can-send gate. Reference implementation for the cross-framework fix (php/ruby/node follow). Test (no mocks): a real TCP server that accepts then never replies - a 1 s timeout fails the send in ~1 s instead of ~30 s, via the constructor and via the env; the default stays 30 and a bad value falls back to 30. Fixes #278 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Tina4 <82961293+tina4stack@users.noreply.github.com> Signed-off-by: Andre van Zuydam <andrevanzuydam@gmail.com>
This was referenced Oct 8, 2026
…278) Re-base the timeout resolution on MichaelC8E's PHP #286 (now the reference for this issue) so all four frameworks behave the same: - priority is constructor > TINA4_MAIL_TIMEOUT > 30; the SMTP_TIMEOUT fallback is dropped. - an explicit constructor value below 1 second RAISES (a programming error), rather than silently coercing to the default. - a garbage or < 1 env value warns ONCE and uses the default 30 (0 is garbage, not an opt-out: to the socket it means do-not-wait). - a silent server is already reported AS a timeout (smtplib surfaces socket.timeout -> 'timed out' in the result message); the test now asserts it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andre van Zuydam <andrevanzuydam@gmail.com>
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.
Reproduced + fixed tina4-python#278 (reference). The SMTP send timeout was hardcoded 30s with no config; a silent host held a worker 30s. Adds a
timeoutconstructor arg +TINA4_MAIL_TIMEOUT(SMTP_TIMEOUTfallback), default 30. No-mock test (real silent TCP server; 1s timeout fails in ~1s). php/ruby/node ports follow. Closes #278.