It's probably because you don't unsubscribe/disconnect from Redis when you call self.finish()
, and so when another message arrives, on_message()
is called again:
def on_message(self,msg):
if msg.kind == 'message':
self.finish(dict(complete=True,message=msg.body))
self.client.unsubscribe('notification')
self.client.disconnect()