Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…or user inquiries
This branch was successfully deployed
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.
Summary
Switches email sending from Resend (flat monthly subscription) to Amazon SES (pay per email), which fits Science Olympiad's seasonal usage much better. Behavior-preserving: every email keeps the same subject, body, and trigger — only _send() in email_service.py changes.
Closes #84
What changed
Backend
Logic
_send()now calls SES v2send_emailviaboto3, run inasyncio.to_threadso it never blocks the event loop.sesv2client per credential set, built from a dedicatedboto3Session (clients are thread-safe, the default session isn't).TooManyRequestsException._SendRateLimiterspaces all sends1 / SES_MAX_SEND_RATEseconds apart so bulk staff invites don't get throttled by SES limits.SES_MAX_ATTEMPTStimes before the address is reported as failed.EMAIL_FROM_ADDRESS) instead of hardcoded; the default is unchanged.SES_MAX_SEND_RATEto quota / N (commented in code).Config
RESEND_API_KEYwithAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION(defaultus-west-2),EMAIL_FROM_ADDRESS,SES_MAX_SEND_RATE(default 1, the sandbox cap),SES_MAX_ATTEMPTS(default 4)..envkeys, so a leftoverRESEND_API_KEYdoesn't crash startup.resend==2.32.2removed from dependencies;boto3==1.43.103added.Out of scope
Test plan
pytestpasses locallyAutomated
tests/services/test_email_service.py: request shape, failure propagation, staff-invite partial failure, real-botocore retry behavior, rate-limit spacing, event loop responsiveness, and unconfigured no-op/prod-raise.mock_send_emailfixture (auth, users, staff invites) pass unchanged.Manual (with personal sandbox SES account in
us-west-2, sending from a verified test domainnexus.kennethlin.dev, Easy DKIM + custom MAIL FROMmail.nexus.kennethlin.dev)NEXUS <[email protected]>, link verifies the account.