Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
migrations: Add progress output to confirmation backfill.
Tim Abbottea6a40661cee
diff --git a/confirmation/migrations/0009_confirmation_expiry_date_backfill.py b/confirmation/migrations/0009_confirmation_expiry_date_backfill.pyindex bc7a74b9df5..6115a1c8ca6 100644--- a/confirmation/migrations/0009_confirmation_expiry_date_backfill.py+++ b/confirmation/migrations/0009_confirmation_expiry_date_backfill.py@@ -38,7 +38,8 @@ def set_expiry_date_for_existing_confirmations()Confirmation.objects.bulk_update(confirmations, ["expiry_date"])- BATCH_SIZE = 1000+ # Because the ranges in this code are inclusive, subtracting 1 offers round numbers.+ BATCH_SIZE = 1000 - 1first_id = Confirmation.objects.earliest("id").idlast_id = Confirmation.objects.latest("id").id@@ -46,6 +47,7 @@ def set_expiry_date_for_existing_confirmations(id_range_lower_bound = first_idid_range_upper_bound = first_id + BATCH_SIZEwhile id_range_lower_bound <= last_id:+ print(f"Processed {id_range_lower_bound} / {last_id}")backfill_confirmations_between(id_range_lower_bound, id_range_upper_bound)id_range_lower_bound = id_range_upper_bound + 1id_range_upper_bound = id_range_lower_bound + BATCH_SIZEdiff --git a/docs/overview/changelog.md b/docs/overview/changelog.mdindex d58afe03769..63971187fd2 100644--- a/docs/overview/changelog.md+++ b/docs/overview/changelog.md@@ -31,7 +31,9 @@ log][commit-log] for an up-to-date list of raw changes.#### Upgrade notes for 5.0-- None yet.+- This release contains a migration, `0009_confirmation_expiry_date_backfill`,+ that can take several minutes to run on a server with millions of+ messages of history.#### Full feature changelog