RED-4653: Renamed function for better clarity and consistency
This commit is contained in:
parent
96e8ac4316
commit
ec769c6cd7
@ -35,9 +35,9 @@ class QueueManager(object):
|
||||
def __init__(self, config: Config = CONFIG):
|
||||
connection_params = get_connection_params(config)
|
||||
|
||||
atexit.register(self.cancel_queue_subscription)
|
||||
signal.signal(signal.SIGTERM, self.cancel_queue_subscription)
|
||||
signal.signal(signal.SIGINT, self.cancel_queue_subscription)
|
||||
atexit.register(self.stop_consuming)
|
||||
signal.signal(signal.SIGTERM, self.stop_consuming)
|
||||
signal.signal(signal.SIGINT, self.stop_consuming)
|
||||
|
||||
self._connection = pika.BlockingConnection(parameters=connection_params)
|
||||
self._channel = self._connection.channel()
|
||||
@ -67,9 +67,9 @@ class QueueManager(object):
|
||||
self._channel.start_consuming()
|
||||
finally:
|
||||
self.logger.warning("An unhandled exception occurred while consuming messages. Consuming will stop.")
|
||||
self.cancel_queue_subscription()
|
||||
self.stop_consuming()
|
||||
|
||||
def cancel_queue_subscription(self):
|
||||
def stop_consuming(self):
|
||||
if self._consumer_token and self._connection:
|
||||
self.logger.info(f"Cancelling subscription for consumer-tag: {self._consumer_token}")
|
||||
self._channel.basic_cancel(self._consumer_token)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user