Skip to content

docs: state the SMTP retry count that mail.rs actually performs - #423

Merged
argszero merged 1 commit into
mainfrom
docs/smtp-retry-count
Oct 20, 2026
Merged

argszero merged 1 commit into
mainfrom
docs/smtp-retry-count

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Two documents state the SMTP verification-mail retry count as three retries. The code performs two retries.

file was now
docs/architecture.md:34 SMTP 验证码(重试 3 次) SMTP 验证码(重试 2 次,共 3 次尝试)
docs/user-stories.md:18 SMTP 失败重试 3 次 SMTP 失败重试 2 次、最多共 3 次尝试

src/mail.rs is unambiguous, and it distinguishes the two words itself:

/// SMTP 发送失败后的重试间隔(固定 2s,不用退避——Gmail 静默丢弃是瞬时的)
const RETRY_DELAY: Duration = Duration::from_secs(2);
/// 最大尝试次数(1 次初始 + 2 次重试)
const MAX_ATTEMPTS: usize = 3;

The file header repeats it — "最多 2 次重试(共 3 次尝试)" — and the loop for attempt in 1..=MAX_ATTEMPTS makes three attempts, sleeping only when attempt < MAX_ATTEMPTS, i.e. twice. So the prose contradicts a constant whose neighbouring comment already names the exact mistake.

Why the number matters. src/routes/mod.rs derives the worst case for the registration path from it: three attempts × 15 s per attempt + 2 × 2 s delay = 49 s of blocked worker. Reading the prose as "3 retries" gives four attempts and three delays = 66 s. Anything sized or timed from the documents is then one attempt too pessimistic — and this is the path register_smtp_failure_502 and the smtp blocking-I/O note in routes/mod.rs both reason about.

Measured on the shipped artifact, not only on main. At release tag v0.7.33 both files carry the same wrong sentence and src/mail.rs carries the same MAX_ATTEMPTS = 3, so the release does not already contain a fix — this is a live defect in what users download.

It was wrong when it was written, not drifted. git log -S "重试 3 次" -- docs/ returns exactly one commit, 6d87213 (the one that introduced the sentence), and MAX_ATTEMPTS has been 3 since 19869d2 — it has never changed. The reword here follows the constant's own vocabulary rather than inventing a third phrasing.

Both carriers are corrected together: they state one fact, so fixing one would leave the other contradicting it.

Related Issue

None — the repository's issue list is empty. This was found by checking the documents' numeric claims against the constants they describe.

Changes

  • Documentation only: two files, one line each. No code, no config, no data-structure change.
  • No configuration or data-structure change, so no example-file sync is needed.

Tests

  • cargo test — 579 passed, 0 failed.
  • cargo fmt --check — passes.
  • No new unit test: this is prose, and no gate reads either file (src/deploy_gate.rs says twice that it does not cover docs/architecture.md; nothing parses docs/user-stories.md).

Checklist

  • Branch name follows the convention (docs/).
  • Commit message uses Conventional Commits.
  • Single purpose, minimal change.

Two documents said the verification mail is retried three times. It is
retried twice: mail.rs declares MAX_ATTEMPTS = 3 and its own comments
spell the difference out — "one initial attempt plus two retries, three
attempts in total".

The distinction is not cosmetic. routes/mod.rs works out the worst case
for the registration path as three attempts x 15s plus two 2s delays;
read as three retries it becomes four attempts and three delays, so any
sizing or timeout question answered from the prose lands one attempt too
high.
@argszero
argszero merged commit c954907 into main Oct 20, 2026
2 checks passed
@argszero
argszero deleted the docs/smtp-retry-count branch October 20, 2026 01:45
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

Successfully merging this pull request may close these issues.

1 participant