Skip to content

Delete background jobs on org delete + ensure org delete happens in background job#3112

Merged
tw4l merged 9 commits intomainfrom
issue-3110-delete-bg-jobs-on-org-delete
Apr 15, 2026
Merged

Delete background jobs on org delete + ensure org delete happens in background job#3112
tw4l merged 9 commits intomainfrom
issue-3110-delete-bg-jobs-on-org-delete

Conversation

@tw4l
Copy link
Copy Markdown
Member

@tw4l tw4l commented Jan 15, 2026

Fixes #3110

  • Delete background jobs in org deletion job*
  • Ensure org deletion always happens in background job

*The one exception is the background job to the delete the org itself - we don't want to delete the database record for the job while the job is actively running, and it seems reasonable to keep this one job in the database as a record that the org once existed.

To follow merging of #3111, before #3113

@tw4l tw4l force-pushed the issue-3110-delete-bg-jobs-on-org-delete branch from 299eaef to 0d5aa1a Compare January 20, 2026 20:24
@tw4l tw4l force-pushed the issue-3110-delete-bg-jobs-on-org-delete branch 2 times, most recently from 65dc5fd to c57ee5f Compare March 25, 2026 17:27
@ikreymer ikreymer self-requested a review April 6, 2026 21:19
@tw4l tw4l force-pushed the issue-3110-delete-bg-jobs-on-org-delete branch from 7fed8cd to c671625 Compare April 9, 2026 20:28
@tw4l tw4l marked this pull request as ready for review April 9, 2026 21:13
tw4l added 9 commits April 15, 2026 11:32
- Only delete k8s resources in operator after job completes to
prevent killing job before it has a chance to delete everything
- Delete all background jobs from database except the delete org
job so there's a record of the org having existed and so that
tests can ensure deletion is successful
- Ensure that all calls of delete_org_and_data method launch a
background job for consistency
- Don't delete org deletion background jobs from db in migration
@ikreymer ikreymer force-pushed the issue-3110-delete-bg-jobs-on-org-delete branch from 8fa2437 to a063d60 Compare April 15, 2026 18:32

if not org.subscription.readOnlyOnCancel:
await self.org_ops.delete_org_and_data(org, self.user_manager)
await self.org_ops.background_job_ops.create_delete_org_job(org)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, good catch on this!

Copy link
Copy Markdown
Member

@ikreymer ikreymer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, tested on dev as well.

@ikreymer ikreymer changed the title Delete background jobs on org delete Delete background jobs on org delete + ensure org delete happens in background job Apr 15, 2026
@tw4l tw4l merged commit 6740054 into main Apr 15, 2026
26 of 27 checks passed
@tw4l tw4l deleted the issue-3110-delete-bg-jobs-on-org-delete branch April 15, 2026 21:20
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.

[Bug]: Background job db entries are not deleted when org is deleted

2 participants