management: Add lockfiles to all _once management jobs.

These would be bad if more than once ran at once.
This commit is contained in:
Alex Vandiver
2024-04-23 19:30:37 +00:00
committed by Tim Abbott
parent 11dd6791c4
commit e8e6abdbba
8 changed files with 16 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ from typing_extensions import override
from zerver.actions.uploads import do_delete_old_unclaimed_attachments
from zerver.lib.attachments import get_old_unclaimed_attachments
from zerver.lib.management import abort_unless_locked
from zerver.lib.upload import all_message_attachments, delete_message_attachments
from zerver.models import ArchivedAttachment, Attachment
@@ -44,6 +45,7 @@ class Command(BaseCommand):
)
@override
@abort_unless_locked
def handle(self, *args: Any, **options: Any) -> None:
delta_weeks = options["delta_weeks"]
print(f"Deleting unclaimed attached files older than {delta_weeks} weeks")