mirror of https://github.com/zulip/zulip.git
users: Send event on commit in do_update_outgoing_webhook_service.
Earlier, we were using 'send_event' in 'do_update_outgoing_webhook_service' which can lead to a situation, if any db operation is added after the 'send_event' in future, where we enqueue events but the action function fails at a later stage. Events should not be sent until we know we're not rolling back. Fixes part of #30489.
This commit is contained in:
parent
30edd1a3b0
commit
2b6c5260a5
|
@ -536,6 +536,7 @@ def do_change_can_create_users(user_profile: UserProfile, value: bool) -> None:
|
|||
user_profile.save(update_fields=["can_create_users"])
|
||||
|
||||
|
||||
@transaction.atomic(durable=True)
|
||||
def do_update_outgoing_webhook_service(
|
||||
bot_profile: UserProfile, service_interface: int, service_payload_url: str
|
||||
) -> None:
|
||||
|
@ -545,7 +546,7 @@ def do_update_outgoing_webhook_service(
|
|||
service.base_url = service_payload_url
|
||||
service.interface = service_interface
|
||||
service.save()
|
||||
send_event(
|
||||
send_event_on_commit(
|
||||
bot_profile.realm,
|
||||
dict(
|
||||
type="realm_bot",
|
||||
|
|
Loading…
Reference in New Issue