H Vs pirms 1 nedēļas
vecāks
revīzija
f45aeb1c4a
1 mainītis faili ar 2 papildinājumiem un 3 dzēšanām
  1. +2
    -3
      tasks.py

+ 2
- 3
tasks.py Parādīt failu

@@ -685,7 +685,6 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config,
chatroom_member_list = list(chatroom_member_list) # 如果 memberList 不是列表,将其转换为列表 chatroom_member_list = list(chatroom_member_list) # 如果 memberList 不是列表,将其转换为列表





remaining_chatroot_members = [x for x in chatroom_member_list if x.get('wxid') not in contact_wxids_set] remaining_chatroot_members = [x for x in chatroom_member_list if x.get('wxid') not in contact_wxids_set]
nickname = next((member['nickName'] for member in chatroom_member_list if member['wxid'] == wxid), None) nickname = next((member['nickName'] for member in chatroom_member_list if member['wxid'] == wxid), None)
@@ -712,7 +711,7 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config,
# 判断是否过于频繁 # 判断是否过于频繁
is_wx_expection = await gewe_service.get_wx_expection_async(wxid,"addGroupMemberAsFriend") is_wx_expection = await gewe_service.get_wx_expection_async(wxid,"addGroupMemberAsFriend")
if is_wx_expection: if is_wx_expection:
logger.info(f"{wxid} 本次任务接口addGroupMemberAsFriend异常,不再邀请,{is_wx_expection}")
logger.info(f"{wxid} 本次任务接口addGroupMemberAsFriend异常,不再邀请,{is_wx_expection}")
return return


contact_wxid= m.get('wxid') contact_wxid= m.get('wxid')
@@ -773,7 +772,7 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config,
k_message = wx_add_contacts_from_chatroom_message(history.wxid,history.chatroomId,history.contactWixd,history.addTime) k_message = wx_add_contacts_from_chatroom_message(history.wxid,history.chatroomId,history.contactWixd,history.addTime)
await kafka_service.send_message_async(k_message) await kafka_service.send_message_async(k_message)
#await asyncio.sleep(random.uniform(1.5, 3)) #await asyncio.sleep(random.uniform(1.5, 3))
await asyncio.sleep(random.uniform(10,60))
await asyncio.sleep(random.uniform(30,60))


# 任务状态推送到kafka # 任务状态推送到kafka
task_status=await gewe_service.wx_add_contacts_from_chatroom_task_status_async(wxid,chatroom_id) task_status=await gewe_service.wx_add_contacts_from_chatroom_task_status_async(wxid,chatroom_id)


Notiek ielāde…
Atcelt
Saglabāt