优化排行榜发送逻辑
This commit is contained in:
16
robot.py
16
robot.py
@@ -683,9 +683,17 @@ class Robot(Job):
|
||||
receivers = self.gbm.get_group_list()
|
||||
if not receivers:
|
||||
return
|
||||
for r in receivers:
|
||||
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
|
||||
output = self.message_storage.generate_and_send_ranking(r, self.allContacts)
|
||||
asyncio.run(self.ipad_bot.send_text_message(r, output))
|
||||
|
||||
async def send_all():
|
||||
tasks = []
|
||||
for r in receivers:
|
||||
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
|
||||
output = self.message_storage.generate_and_send_ranking(r, self.allContacts)
|
||||
tasks.append(self.ipad_bot.send_text_message(r, output))
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
asyncio.run(send_all())
|
||||
|
||||
except Exception as e:
|
||||
self.LOG.error(f"SendRanking error:{e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user