catch KeyboardInterrupt
This commit is contained in:
@ -22,6 +22,6 @@ try:
|
||||
channel.basic_qos(prefetch_count=1)
|
||||
channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True)
|
||||
channel.start_consuming()
|
||||
except Exception:
|
||||
except KeyboardInterrupt:
|
||||
connection.close()
|
||||
print(DATETIMES)
|
||||
|
@ -10,5 +10,5 @@ try:
|
||||
binstring = string.encode('UTF-8')
|
||||
while True:
|
||||
channel.basic_publish(exchange="test",routing_key="test",body=binstring)
|
||||
except Exception:
|
||||
except KeyboardInterrupt:
|
||||
connection.close()
|
||||
|
Reference in New Issue
Block a user