close at the end

This commit is contained in:
Torma Kristóf 2021-04-25 13:11:10 +02:00
parent bc9d2493a9
commit b69d6032b2
3 changed files with 3 additions and 2 deletions

View File

@ -27,3 +27,4 @@ except KeyboardInterrupt:
dt[dts] +=1
for key in dt:
print(key,",",dt[key])
consumer.close()

View File

@ -23,7 +23,6 @@ try:
channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True)
channel.start_consuming()
except KeyboardInterrupt:
connection.close()
dt = {}
for datetime in DATETIMES:
dts = datetime.strftime("%m/%d/%Y, %H:%M:%S")
@ -33,3 +32,4 @@ except KeyboardInterrupt:
dt[dts] +=1
for key in dt:
print(key,",",dt[key])
connection.close()

View File

@ -17,7 +17,6 @@ try:
m = socket.recv_string()
DATETIMES.append(datetime.now())
except KeyboardInterrupt:
socket.close()
dt = {}
for datetime in DATETIMES:
dts = datetime.strftime("%m/%d/%Y, %H:%M:%S")
@ -27,3 +26,4 @@ except KeyboardInterrupt:
dt[dts] +=1
for key in dt:
print(key,",",dt[key])
socket.close()