catch KeyboardInterrupt
This commit is contained in:
@ -16,6 +16,6 @@ try:
|
||||
for message in consumer:
|
||||
DATETIMES.append(datetime.now())
|
||||
consumer.close()
|
||||
except Exception:
|
||||
except KeyboardInterrupt:
|
||||
consumer.close()
|
||||
print(DATETIMES)
|
||||
|
@ -11,5 +11,5 @@ try:
|
||||
binstring = string.encode('UTF-8')
|
||||
while True:
|
||||
producer.send('test', binstring)
|
||||
except Exception:
|
||||
except KeyboardInterrupt:
|
||||
producer.close()
|
||||
|
Reference in New Issue
Block a user