Add admin action to delete scheduled maintenance tasks - #464
Merged
gaidheal1 merged 7 commits intoJun 28, 2026
Conversation
Add guidelines for bug reports, feature requests, and code contributions.
Create CONTRIBUTING.md with contribution guidelines
Staging to Main
Timer stop & auth session hotfix
Multiple concurrent 401 responses each called clearAuthAndRedirect(), scheduling separate window.location.href redirects that fired in sequence and repeatedly reloaded /login. Replace the hard redirect with a custom DOM event (auth:expired). AuthContext listens for it and calls logout(), setting isAuthenticated=false. PrivateRoute then does a single React Router navigate to /login — no hard reload, no loop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(auth): prevent repeated login-page reloads on session expiry
- Add scheduled_task_ids JSONField to MaintenanceWindow to track Celery task IDs - Update schedule_tasks() to capture and store task IDs from apply_async - Implement delete_scheduled_tasks() to revoke tasks via Celery control API - Add delete_tasks admin view handler and URL (/delete-tasks/) - Pass delete_url in change_view context - Add 'Delete scheduled tasks' button to admin change form template - Add migration for scheduled_task_ids field Closes #140 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Admins currently have no way to cancel the Celery tasks (warnings + activation) that get queued when a maintenance window is scheduled. This means if a window is changed or cancelled, stale tasks will still fire at the original times.
Approach
To make revocation possible, task IDs need to be persisted at scheduling time. The changes:
MaintenanceWindowmodel -- adds ascheduled_task_idsJSONField to store the Celery task IDs returned byapply_asyncwhenschedule_tasks()is called.delete_scheduled_tasks()method -- new model method that callscurrent_app.control.revoke()on each stored task ID, then resetstasks_scheduled = Falseand clears the list.delete_tasksview handler and/delete-tasks/URL following the same pattern as the existingschedule_taskshandler, plus a "Delete scheduled tasks" button in the change-form template.scheduled_task_idsto theMaintenanceWindowtable.Revocation without
terminate=Trueis used since warning and activation tasks are queued for future execution and won't have started yet.Fixes: #140