-
Notifications
You must be signed in to change notification settings - Fork 415
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
fix: Long DELETE
project call
#3360
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
8afd597
to
11f24e0
Compare
ce0b69a
to
c9d5564
Compare
c9d5564
to
5188323
Compare
5188323
to
6eebc02
Compare
6eebc02
to
1fa3ac5
Compare
Yeah, it was a tricky one. The issue was here. The signals weren't getting added, so no AuditLog record was being created. |
# Conflicts: # .github/workflows/api-pull-request.yml
environment, project = history_instance.instance.get_environment_and_project() | ||
if project != history_instance.instance and ( | ||
(project and project.deleted_at) | ||
or (environment and environment.project.deleted_at) | ||
): | ||
# don't trigger audit log records in deleted projects | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is arguably unrelated to this PR but I think it's a good improvement here to prevent unnecessary data in the AuditLog table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's sorta unrelated but it's a good addition.
from environments.tasks import delete_environment | ||
from features.tasks import delete_feature | ||
from projects.models import Project | ||
from segments.tasks import delete_segment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, yeah, I tried to resolve this but I ended up just diving into a hell hole of circular dependencies. It annoyingly made testing a little harder because I can't mock the imports, but I do feel like it's not a major issue for tasks to have local imports given their place in the stack.
@@ -0,0 +1,20 @@ | |||
# Generated by Django 3.2.23 on 2024-02-01 12:12 | |||
|
|||
from django.db import migrations, models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the sqlmigrate output for these migrations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❯ python manage.py sqlmigrate features 0063
BEGIN;
--
-- Alter field project on feature
--
COMMIT;
❯ python manage.py sqlmigrate features 0064
BEGIN;
--
-- Alter field project on feature
--
--
-- Alter field project on historicalfeature
--
COMMIT;
] | ||
|
||
operations = [ | ||
migrations.AlterField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sqlmigrate output:
❯ python manage.py sqlmigrate environments 0034
BEGIN;
--
-- Alter field project on environment
--
COMMIT;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django migrations for this silly stuff is always a bit of an eye roll
] | ||
|
||
operations = [ | ||
migrations.AlterField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sqlmigrate output:
❯ python manage.py sqlmigrate segments 0020
BEGIN;
--
-- Alter field project on segment
--
COMMIT;
Well it's great that the test suite caught it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
environment, project = history_instance.instance.get_environment_and_project() | ||
if project != history_instance.instance and ( | ||
(project and project.deleted_at) | ||
or (environment and environment.project.deleted_at) | ||
): | ||
# don't trigger audit log records in deleted projects | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's sorta unrelated but it's a good addition.
] | ||
|
||
operations = [ | ||
migrations.AlterField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django migrations for this silly stuff is always a bit of an eye roll
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
Closes #3302.
This introduces the following changes:
test_recurring_task_run_should_execute_first_run_at
failing whenone_hour_from_now
parameter is next day.How did you test this code?
Added unit tests; created and deleted large projects locally.