Skip to content

Commit

Permalink
Add more details to TODO comment
Browse files Browse the repository at this point in the history
Add sleep to unit test to troubleshoot failure
  • Loading branch information
NeonDaniel committed Jan 10, 2025
1 parent d6ca865 commit dcfd49c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion neon_mq_connector/consumers/select_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def _close_connection(self, mark_consumer_as_dead: bool = True):

def reconnect(self, wait_interval: int = 5):
self._close_connection(mark_consumer_as_dead=False)
# TODO: Find a better way to wait for shutdown/server restart
# TODO: Find a better way to wait for shutdown/server restart. This will
# fail to reconnect if the server isn't back up within `wait_interval`
time.sleep(wait_interval)
self.run()

Expand Down
1 change: 1 addition & 0 deletions tests/test_consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def test_handle_reconnection(self):
test_thread.on_close.assert_not_called()

self.rmq_instance.stop()
sleep(1) # Wait for the client to finish disconnecting
test_thread.on_close.assert_called_once()
self.assertFalse(test_thread.is_consuming)
self.assertTrue(test_thread.is_consumer_alive)
Expand Down

0 comments on commit dcfd49c

Please sign in to comment.