From 34839bbccea04068d7de865a2ca049144bd65081 Mon Sep 17 00:00:00 2001 From: cka-y Date: Tue, 12 Nov 2024 12:23:17 -0500 Subject: [PATCH] test: blocking execution until the message is published --- api/src/scripts/load_dataset_on_create.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/scripts/load_dataset_on_create.py b/api/src/scripts/load_dataset_on_create.py index c211bfe13..ce22ff7f4 100644 --- a/api/src/scripts/load_dataset_on_create.py +++ b/api/src/scripts/load_dataset_on_create.py @@ -67,6 +67,8 @@ def publish(feed: Feed, topic_path: str): data_bytes = json.dumps(payload).encode("utf-8") future = get_pubsub_client().publish(topic_path, data=data_bytes) future.add_done_callback(lambda _: publish_callback(future, feed.stable_id, topic_path)) + # Block until the message is published + future.result() # This will wait until the publishing is confirmed def publish_all(feeds: List[Feed]):