zulip/zilencer/management/commands
Tim Abbott 027b67be80 presence: Rewrite the backend data model.
This implements the core of the rewrite described in:

For the backend data model for UserPresence to one that supports much
more efficient queries and is more correct around handling of multiple
clients.  The main loss of functionality is that we no longer track
which Client sent presence data (so we will no longer be able to say
using UserPresence "the user was last online on their desktop 15
minutes ago, but was online with their phone 3 minutes ago").  If we
consider that information important for the occasional investigation
query, we have can construct that answer data via UserActivity
already.  It's not worth making Presence much more expensive/complex
to support it.

For slim_presence clients, this sends the same data format we sent
before, albeit with less complexity involved in constructing it.  Note
that we at present will always send both last_active_time and
last_connected_time; we may revisit that in the future.

This commit doesn't include the finalizing migration, which drops the
UserPresenceOld table.
The way to deploy is to start the backfill migration with the server
down and then start the server *without* the user_presence queue worker,
to let the migration finish without having new data interfering with it.
Once the migration is done, the queue worker can be started, leading to
the presence data catching up to the current state as the queue worker
goes over the queued up events and updating the UserPresence table.

Co-authored-by: Mateusz Mandera <mateusz.mandera@zulip.com>
2023-04-26 14:26:47 -07:00
..
__init__.py
add_mock_conversation.py actions: Split out zerver.actions.reactions. 2022-04-14 17:14:35 -07:00
calculate_first_visible_message_id.py management: Fix typing for management scripts. 2021-08-20 05:54:18 -07:00
compare_messages.py render_messages: Use JSON Lines format. 2021-05-20 13:12:16 -07:00
downgrade_small_realms_behind_on_payments.py billing: Downgrade small realms that are behind on payments. 2021-07-02 13:19:12 -07:00
invoice_plans.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
mark_all_messages_unread.py python: Clean up getattr, setattr, delattr calls with literal names. 2022-10-10 08:40:28 -07:00
populate_db.py presence: Rewrite the backend data model. 2023-04-26 14:26:47 -07:00
print_initial_password.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
profile_request.py profile_request: Use modern Django middleware API. 2022-01-13 21:03:22 -08:00
queue_rate.py queue_rate: Output to CSV, and run multiple prefetch values. 2021-11-16 11:48:50 -08:00
render_messages.py render_messages: Tighten function signatures with generic QuerySet. 2022-07-07 11:27:43 -07:00
rundjangoserver.py ruff: Fix PIE810 Call `startswith` once with a `tuple`. 2023-02-08 16:40:35 -08:00
switch_realm_from_standard_to_plus_plan.py billing: Add command for switching plans from Standard to Plus. 2021-10-15 17:27:50 -07:00
sync_api_key.py python: Convert percent formatting to Python 3.6 f-strings. 2020-06-10 15:02:09 -07:00