Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
docs: Rename 'send_event' to 'send_event_on_commit'.
Prakhar Pratyusha7f48e260cce
diff --git a/docs/overview/directory-structure.md b/docs/overview/directory-structure.mdindex a674ebf499b..8a9f2743b32 100644--- a/docs/overview/directory-structure.md+++ b/docs/overview/directory-structure.md@@ -25,7 +25,7 @@ paths will be familiar to Django developers.- `zerver/actions/*.py` Most code doing writes to user-facingdatabase tables lives here. In particular, we have a policy that- all code calling `send_event` to trigger [pushing data to+ all code calling `send_event_on_commit` to trigger [pushing data toclients](../subsystems/events-system.md) must live here.- `zerver/views/*.py` Most [Django views](https://docs.djangoproject.com/en/5.0/topics/http/views/).diff --git a/docs/subsystems/events-system.md b/docs/subsystems/events-system.mdindex 434ebbec361..623587980c3 100644--- a/docs/subsystems/events-system.md+++ b/docs/subsystems/events-system.md@@ -51,16 +51,16 @@ problems in a scalable, correct, and predictable way.## Generation systemZulip's generation system is built around a Python function,-`send_event(realm, event, users)`. It accepts the realm (used for+`send_event_on_commit(realm, event, users)`. It accepts the realm (used forsharding), the event data structure (just a Python dictionary withsome keys and value; `type` is always one of the keys but the restdepends on the specific event) and a list of user IDs for the userswhose clients should receive the event. In special cases such asmessage delivery, the list of users will instead be a list of dictsmapping user IDs to user-specific data like whether that user was-mentioned in that message. The data passed to `send_event` are simply-marshalled as JSON and placed in the `notify_tornado` RabbitMQ queue-to be consumed by the delivery system.+mentioned in that message. The data passed to `send_event_on_commit` are+simply marshalled as JSON and placed in the `notify_tornado` RabbitMQ+queue to be consumed by the delivery system.Usually, this list of users is one of 3 things:@@ -71,8 +71,8 @@ Usually, this list of users is one of 3 things:reactions, message editing, etc.); i.e. the subscribers to a channelor the people on a direct message thread.-It is the responsibility of the caller of `send_event` to choose the-list of user IDs correctly. There can be security problems if, for+It is the responsibility of the caller of `send_event_on_commit` to choose+the list of user IDs correctly. There can be security problems if, forexample, an event containing direct message content is sent to theentire organization. However, if an event isn't sent to enough clients,there will likely be user-visible real-time sync bugs.@@ -388,9 +388,9 @@ The final detail we need to ensure that `apply_events` always workscorrectly is to make sure that we have relevant tests forevery event type that can be generated by Zulip. This can be testedmanually using `test-backend --coverage BaseAction` and then-checking that all the calls to `send_event` are covered. Someday-we'll add automation that verifies this directly by inspecting the-coverage data.+checking that all the calls to `send_event_on_commit` are covered.+Someday we'll add automation that verifies this directly by inspecting+the coverage data.#### page_paramsdiff --git a/docs/subsystems/notifications.md b/docs/subsystems/notifications.mdindex 59a6aa77725..77e3f0a1108 100644--- a/docs/subsystems/notifications.md+++ b/docs/subsystems/notifications.md@@ -27,11 +27,11 @@ As a reminder, the relevant part of the flow for sending messages isas follows:- `do_send_messages` is the synchronous message-sending code path,- and passing the following data in its `send_event` call:+ and passing the following data in its `send_event_on_commit` call:- Data about the message's content (e.g., mentions, wildcardmentions, and alert words) and encodes it into the `UserMessage`table's `flags` structure, which is in turn passed into- `send_event` for each user receiving the message.+ `send_event_on_commit` for each user receiving the message.- Data about user configuration relevant to the message, such as`online_push_user_ids` and `stream_notify_user_ids`, are includedin the main event dictionary.@@ -141,8 +141,8 @@ structure of the system, when thinking about changes to it:details from the database like "which users receiving this messageare online".- **Thousands of users**. Zulip supports thousands of users, and we- want to avoid `send_event()` pushing large amounts of per-user data- to Tornado via RabbitMQ for scalability reasons.+ want to avoid `send_event_on_commit()` pushing large amounts of+ per-user data to Tornado via RabbitMQ for scalability reasons.- **Tornado doesn't do database queries**. Because the Tornado systemis an asynchronous event-driven framework, and our Django databaselibrary is synchronous, database queries are very expensive. Sodiff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.mdindex 79c0643e000..be8fda0b0eb 100644--- a/docs/tutorials/new-feature-tutorial.md+++ b/docs/tutorials/new-feature-tutorial.md@@ -277,7 +277,7 @@ first contacts the server, the server sends the client itsinitial state. Subsequently, clients subscribe to "events," which can(among other things) indicate that settings have changed.-For the backend piece, we will need our action to make a call to `send_event`+For the backend piece, we will need our action to make a call to `send_event_on_commit`to send the event to clients that are active. We will also need tomodify `fetch_initial_state_data` so that the new field is passed toclients. See [our event system docs](../subsystems/events-system.md) for all the@@ -299,7 +299,7 @@ help catch coding mistakes, not to check for bad user input.After updating the given realm field, `do_set_realm_property` createsan 'update' event with the name of the property and the new value. It-then calls `send_event`, passing the event and the list of users whose+then calls `send_event_on_commit`, passing the event and the list of users whosebrowser sessions should be notified as the second argument. The latterargument can be a single user (if the setting is a personal one, liketime display format), members in a particular channel only or all@@ -327,7 +327,7 @@ def do_set_realm_property(property=name,value=value,)- send_event(realm, event, active_user_ids(realm))+ send_event_on_commit(realm, event, active_user_ids(realm))```If the new realm property being added does not fit into the@@ -351,7 +351,7 @@ def do_set_realm_authentication_methods(property='default',data=dict(authentication_methods=realm.authentication_methods_dict()))- send_event(realm, event, active_user_ids(realm))+ send_event_on_commit(realm, event, active_user_ids(realm))```### Update application statediff --git a/docs/tutorials/writing-views.md b/docs/tutorials/writing-views.mdindex 6f78fd3cb63..1cbbe1b67a8 100644--- a/docs/tutorials/writing-views.md+++ b/docs/tutorials/writing-views.md@@ -332,7 +332,7 @@ def update_realm(````realm.save()` actually saves the changes to the realm to the-database, and `send_event` sends the event to active clients belonging+database, and `send_event_on_commit` sends the event to active clients belongingto the provided list of users (in this case, all active users in theZulip realm).