diff --git a/update/consumers.py b/update/consumers.py index 1fe251b..6a674d1 100644 --- a/update/consumers.py +++ b/update/consumers.py @@ -13,7 +13,6 @@ class UpdateConsumer(WebsocketConsumer): redis_conn = get_redis_connection() - if text_data is None: self.send('你发了啥') else: @@ -27,12 +26,15 @@ class UpdateConsumer(WebsocketConsumer): redis_key = f'cinema_update_status_{ip}' if redis_conn.exists(redis_key): redis_conn.delete(redis_key) - print(cinema_update_status.get(ip, None)) + data = json.loads(redis_conn.get(redis_key)) + print('ws任务完成消息', data) + if data.get('ip', False): ip = data['ip'] redis_key = f'cinema_update_status_{ip}' # print('ws发送消息前', cinema_update_status) data = json.loads(redis_conn.get(redis_key)) + print('ws发送消息前', data) self.send(json.dumps({'status': {'ip': ip, 'result': data}})) else: self.send(text_data)