Explorar el Código

Update agent_service: add white list

StrayWarrior hace 8 horas
padre
commit
d1c8ab9a81
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      agent_service.py

+ 5 - 2
agent_service.py

@@ -166,11 +166,14 @@ class AgentService:
         logger.warning(f"staff[{staff_id}] user[{user_id}]: response[{message_type}] {response}")
         current_ts = int(time.time() * 1000)
         user_tags = self.user_relation_manager.get_user_tags(user_id)
+        white_list_tags = {'AgentTest1', '04W4-YR-1', '04W4-YR-2', '04W4-KK-1', '04W4-SQ-1'}
+        hit_white_list_tags = len(set(user_tags).intersection(white_list_tags)) > 0
         # FIXME(zhoutian)
         # 测试期间临时逻辑,只发送特定的账号或特定用户
         user_black_lists = ['7881300148979455',]
-        if not (staff_id in set(['1688854492669990'])
-                or 'AgentTest1' in user_tags) or user_id in user_black_lists:
+        staff_white_lists = ['1688854492669990',]
+        if not (staff_id in staff_white_lists or hit_white_list_tags) \
+                or user_id in user_black_lists:
             logger.warning(f"staff[{staff_id}] user[{user_id}]: skip reply")
             return None
         self.send_queue.produce(