queue: Rename queue_json_publish to queue_json_publish_rollback_unsafe.

This commit renames the 'queue_json_publish' function to
'queue_json_publish_rollback_unsafe' to reflect the fact that it doesn't
wait for the db transaction (within which it gets called, if any)
to commit and sends event irrespective of commit or rollback.

In most of the cases we don't want to send event in the case of
rollbacks, so the caller should be aware that calling the function
directly is rollback unsafe.

Fixes part of #30489.
This commit is contained in:
Prakhar Pratyush
2024-12-06 12:14:03 +05:30
committed by Tim Abbott
parent 1847086044
commit 3bad36ef8c
24 changed files with 63 additions and 53 deletions

View File

@@ -6,7 +6,7 @@ import orjson
from typing_extensions import override
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.queue import queue_json_publish
from zerver.lib.queue import queue_json_publish_rollback_unsafe
def error(*args: Any) -> None:
@@ -28,7 +28,7 @@ def enqueue_file(queue_name: str, f: IO[str]) -> None:
# This is designed to use the `error` method rather than
# the call_consume_in_tests flow.
queue_json_publish(queue_name, data, error)
queue_json_publish_rollback_unsafe(queue_name, data, error)
class Command(ZulipBaseCommand):