Repository navigation
feat(emails): schedule a send with scheduled_at #370
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
Open
Silthus
wants to merge
22
commits into
main
Choose a base branch
from
feat/scheduled-email-send
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+420
−23
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1ae7ecf
feat(emails): schedule a send with scheduled_at
Silthus d072918
fix(emails): confirm the exact scheduled instant and keep app host cr…
Silthus a585386
refactor(emails): format scheduled_at with the shared ISO 8601 helper
Silthus b1304d2
fix(emails): log send warnings after the send settles
Silthus 7b53e92
fix(emails): let interrupts through while logging and refuse non-UTF-…
Silthus 0e86b5c
fix(emails): refuse a send-now answer for a time more than a minute a…
Silthus f0fa1c0
test(emails): pin the send-now cutoff to the minute and show a caller…
Silthus 430a8f2
fix(emails): let a deadline with an error class through while logging…
Silthus 9e3b814
fix(emails): measure the send-now minute from the send and never repl…
Silthus 8a90d74
test(emails): pin the send-now clock to the first attempt across retries
Silthus eadc96e
revert: test(emails): pin the send-now clock to the first attempt acr…
Silthus 3e4f675
test(emails): pin the send-now clock across retries and assert settle…
Silthus 9a20902
fix(emails): give a logger's reused exception the failed send's cause
Silthus 9d093b8
fix(emails): raise a copy of a logger's reused exception
Silthus abd954b
fix(emails): raise the send's error when a logger's exception can't b…
Silthus c79edb5
fix(emails): let a caller's deadline through while copying a logger's…
Silthus df58abf
fix(emails): stop copying a logger's exception
Silthus f41adaa
fix(emails): never log a failed send's warnings, carry them on its error
Silthus 071000a
chore(emails): name EmailError#warnings in the changeset
Silthus 2dfb241
test(emails): drive the logger specs through a real logger's formatter
Silthus 17744e9
docs(emails): name the pattern-match change of SendResult's new member
Silthus bdda344
fix(emails): refuse a scheduled_at string in an encoding the pattern …
Silthus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "posthog-ruby": minor | ||
| --- | ||
|
|
||
| Schedule a transactional email with `scheduled_at` on `emails.send`, at most 7 days ahead, on PostHog Cloud. The result's `status` is `scheduled` with the confirmed `scheduled_at`, or `queued` when the time had passed. `emails.get` reads `scheduled` until the email goes out. The client rounds a finer time up to the next millisecond and refuses a time without an offset. It refuses to schedule on any host other than PostHog Cloud US or EU, and raises `schedule_not_confirmed` with `EmailError#message_id` when PostHog accepts the email without confirming its time, also when PostHog would send now an email due more than a minute ahead. That error carries the reply's warnings on the new `EmailError#warnings`, and the client logs warnings only for a send that succeeds. `SendResult` gains a `scheduled_at` member, so a `SendResult` marshaled by an earlier version, such as one in a Rails cache, doesn't load in this version, and one marshaled by this version doesn't load in an earlier one. The new member also changes code that takes `SendResult` apart by position: a pattern match on three elements, such as `in [id, replayed, warnings]`, no longer matches, and `to_h` and `to_a` gain `scheduled_at`. A hash pattern such as `in { id: }` still matches. |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.