catch KeyboardInterrupt

This commit is contained in:
2021-04-25 12:24:41 +02:00
parent 0c11b0293c
commit 9af55c9b76
6 changed files with 6 additions and 7 deletions

View File

@ -16,6 +16,6 @@ try:
for message in consumer:
DATETIMES.append(datetime.now())
consumer.close()
except Exception:
except KeyboardInterrupt:
consumer.close()
print(DATETIMES)

View File

@ -11,5 +11,5 @@ try:
binstring = string.encode('UTF-8')
while True:
producer.send('test', binstring)
except Exception:
except KeyboardInterrupt:
producer.close()