users: Add transaction.atomic decorator to do_update_bot_config_data.

The db operations in do_update_bot_config_data should be atomic.
This commit is contained in:
Prakhar Pratyush 2024-08-23 11:18:10 +05:30 committed by Tim Abbott
parent 8f2727fcea
commit 30edd1a3b0
1 changed files with 2 additions and 1 deletions

View File

@ -563,11 +563,12 @@ def do_update_outgoing_webhook_service(
) )
@transaction.atomic(durable=True)
def do_update_bot_config_data(bot_profile: UserProfile, config_data: dict[str, str]) -> None: def do_update_bot_config_data(bot_profile: UserProfile, config_data: dict[str, str]) -> None:
for key, value in config_data.items(): for key, value in config_data.items():
set_bot_config(bot_profile, key, value) set_bot_config(bot_profile, key, value)
updated_config_data = get_bot_config(bot_profile) updated_config_data = get_bot_config(bot_profile)
send_event( send_event_on_commit(
bot_profile.realm, bot_profile.realm,
dict( dict(
type="realm_bot", type="realm_bot",