Skip to content

Commit

Permalink
Add time between multi-response emits to help responses be handled sy…
Browse files Browse the repository at this point in the history
…nchronously

Add note to address synchronization of responses
  • Loading branch information
NeonDaniel committed Dec 11, 2024
1 parent 162510a commit 7b3d4d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions neon_mq_connector/utils/client_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def handle_mq_response(channel: Channel, method, _, body):
LOG.debug(f'MQ output: {api_output}')
channel.basic_ack(delivery_tag=method.delivery_tag)
if isinstance(api_output.get('_part'), int):
# TODO: Consider forcing these to be passed to `stream_callback` synchronously
# Handle multi-part responses
if stream_callback:
# Pass each part to the stream callback method if defined
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def respond_multiple(channel, method, _, body):
routing_key=reply_channel,
body=dict_to_b64(response),
properties=pika.BasicProperties(expiration='1000'))
time.sleep(0.5) # Used to ensure synchronous response handling
channel.basic_ack(delivery_tag=method.delivery_tag)


Expand Down

0 comments on commit 7b3d4d8

Please sign in to comment.