Kaynağa Gözat

Update user_manager: remove FIXME, change batch size in UserRelationManager

StrayWarrior 6 gün önce
ebeveyn
işleme
fd7e4095ca
1 değiştirilmiş dosya ile 1 ekleme ve 5 silme
  1. 1 5
      user_manager.py

+ 1 - 5
user_manager.py

@@ -253,10 +253,7 @@ class MySQLUserRelationManager(UserRelationManager):
         return []
 
     def list_staff_users(self, staff_id: str = None, tag_id: int = None):
-        # FIXME(zhoutian)
-        # 测试期间逻辑,只取一个账号
         sql = f"SELECT third_party_user_id, wxid FROM {self.agent_staff_table} WHERE status = 1"
-               # f" AND third_party_user_id in ('1688854492669990', '1688855931724582')")
         if staff_id:
             sql += f" AND third_party_user_id = '{staff_id}'"
         agent_staff_data = self.agent_db.select(sql, pymysql.cursors.DictCursor)
@@ -277,7 +274,6 @@ class MySQLUserRelationManager(UserRelationManager):
                 logger.warning(f"staff[{wxid}] has no user")
                 continue
             user_ids = tuple(user['user_id'] for user in user_data)
-            # FIXME(zhoutian): 测试期间临时逻辑
             sql = f"SELECT union_id FROM {self.user_table} WHERE id IN {str(user_ids)} AND union_id is not null"
             if tag_id:
                 sql += f" AND id in (SELECT distinct user_id FROM we_com_user_with_tag WHERE tag_id = {tag_id} and is_delete = 0)"
@@ -286,7 +282,7 @@ class MySQLUserRelationManager(UserRelationManager):
                 logger.warning(f"staff[{wxid}] users not found in wecom database")
                 continue
             user_union_ids = tuple(user['union_id'] for user in user_data)
-            batch_size = 100
+            batch_size = 500
             n_batches = (len(user_union_ids) + batch_size - 1) // batch_size
             agent_user_data = []
             for i in range(n_batches):