Fix for funcom's roster delays.

Orgbots will run the roster 24 hours and 15 minutes after the last one funcom published on PORK; Onlinebots 24 hours and 10 minutes of the slowest roster maintained.
This commit is contained in:
2022-07-30 13:40:53 +02:00
parent c1196892ba
commit d4d08b3054
2 changed files with 20 additions and 0 deletions
@@ -1,3 +1,4 @@
import datetime
import json
import time
import typing
@@ -196,6 +197,14 @@ class OrgRosterController:
[self.public_channel_service.org_id])
conn.commit()
self.bot.send_org_message('Successfully updated the roster.')
d = datetime.datetime.strptime(result[2] + " +0000", '%Y/%m/%d %H:%M:%S %z').timestamp()
while (d + 24*60*60) < datetime.datetime.now().timestamp():
d += 24*60*60
self.db.exec("UPDATE timer_event SET next_run=? WHERE handler=? AND event_sub_type=?", [
int(d+24*60*60 + 15*60),
"modules.orgbot.org.org_roster_controller.OrgRosterController.update_roster",
86400
])
@event(PublicChannelService.ORG_MSG_EVENT, "Update org roster when characters join or leave", is_hidden=True)
def org_msg_event(self, _, event_data):