Skip to content

Commit

Permalink
test: blocking execution until the message is published
Browse files Browse the repository at this point in the history
  • Loading branch information
cka-y committed Nov 12, 2024
1 parent 9b385e2 commit 34839bb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/src/scripts/load_dataset_on_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down

0 comments on commit 34839bb

Please sign in to comment.