Signal-arm the deadline warning and delete the sweep - #1097
Open
johnpooch wants to merge 1 commit into
Open
Conversation
Replace the `phase.send_deadline_warnings` periodic cron sweep with a per-phase job armed at `scheduled_resolution - threshold`, mirroring the existing phase-resolution arming. - Add `Phase.warning_job_id` (migration) and drop the now-unused `PhaseState.deadline_warning_sent_for` marker; dedup is inherent to a single armed job re-armed on change. - Move the warning-threshold table into `phase.utils.deadline_warning_offset` so the arm computation owns it. - Add `arm_deadline_warning` alongside `arm_deadline_resolution`, dispatched from a single `arm_deadline_jobs` post_save receiver that cancels and re-arms both jobs when the deadline or status changes. - Add the `phase.send_deadline_warning(phase_id)` task and manager method that evaluate recipients at fire time (has_possible_orders, not confirmed, active), so confirm / unconfirm / extension need no per-player cancellation. - Delete the periodic sweep task and the `send_deadline_warnings` manager method; migrate tests to the per-phase method and add warning-arming tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018trT4XjJMoto7uxYkafSBp
Contributor
|
Warning WIP limit exceeded. There are now 9 open pull requests — the project target is 5 or fewer. Please close or merge an existing PR before continuing with this one. |
✅ Deploy Preview for diplicity-variant-creator canceled.
|
4 tasks
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.
What this PR does
Closes #1073. Replaces the every-minute
phase.send_deadline_warningscron sweep with a per-phase job armed atscheduled_resolution - threshold, re-armed when the deadline or status changes and evaluated at fire time — mirroring the existing phase-resolution arming.Because recipients are evaluated when the job fires (not when it's armed), confirm / unconfirm / extension all "just work" with no per-player cancellation, which lets the old per-player
deadline_warning_sent_fordedup marker go away entirely.Changes:
Phase.warning_job_id(migration0017) and drop the now-unusedPhaseState.deadline_warning_sent_forfield.phase.utils.deadline_warning_offset, which the arm computation owns.arm_deadline_warningalongsidearm_deadline_resolution, both dispatched from a singlearm_deadline_jobspost_save receiver that cancels and re-arms each job on change.phase.send_deadline_warning(phase_id)task + manager method, which evaluates recipients at fire time (has_possible_orders, not confirmed, active) and emitsdeadline_warning.send_deadline_warningsmanager method. The resolution canary sweep (sweep_due_phases) is untouched.Checklist
/review-pragainst this PR in Claude Code and addressed (or responded to) its findings🤖 Generated with Claude Code
Generated by Claude Code