chore(attachmentStorage): Update sync management command to support no lock during execution #5307
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.
📣 Summary
Added an option to the
update_attachment_storage_bytes
management command to prevent user submission suspension. Updated logic to handle thesubmissions_suspended
flag conditionally.📖 Description
This PR updates the
update_attachment_storage_bytes
management command to support a "no lock" mode. Previously, the command would set thesubmissions_suspended
flag to True during its execution, preventing users from submitting data until the process was complete.Introduced a new argument/option to skip toggling the
submissions_suspended
flag.Default behavior (suspending submissions) remains unchanged to avoid breaking existing workflows.
When the "no lock" option is enabled, the command synchronizes attachment storage without blocking user submissions.
The
{"no_lock": true}
option can now be passed to thesync_storage_counters
periodic task (if it was previously added).If
sync_storage_counters
has already been added as a periodic task, you should also addfix_stale_submissions_suspended_flag
to ensure that accidentally locked accounts are unlocked.💭 Notes
no_lock
option could result in discrepancies since submissions could continue to come in while the process is still counting storage usage.