Skip to content

Commit

Permalink
Update pubsub configuration (#195)
Browse files Browse the repository at this point in the history
* Update pubsub configuration

Set the batch message number to 1, so that messages are immediately published to the topic (instead of waiting for multiple messages to send as a batch)

* Fix linting
  • Loading branch information
samanehsan authored Nov 25, 2019
1 parent 0500aab commit 082ff75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lira/api/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def post(body):

project_id = lira_config.google_project
topic_name = lira_config.google_pubsub_topic
batch_settings = pubsub_v1.types.BatchSettings(max_messages=1)
publisher = pubsub_v1.PublisherClient.from_service_account_file(
lira_config.caas_key
lira_config.caas_key, batch_settings=batch_settings
)
topic_path = publisher.topic_path(project_id, topic_name)
message = json.dumps(body).encode("utf-8")
Expand Down

0 comments on commit 082ff75

Please sign in to comment.