Skip to content

Commit

Permalink
refactor: Improve scheduled tasks
Browse files Browse the repository at this point in the history
Fix FarmChecker run time
Remove fetch source string task
Change push source string task run time to every hour
  • Loading branch information
seriaati committed Mar 13, 2024
1 parent 86c6fbb commit 1e0aaa6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hoyo_buddy/cogs/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def schedule(self) -> None:
asyncio.create_task(DailyCheckin.execute(self.bot))

# Every day at 04:00, 11:00, 17:00
if now.hour in {4, 11, 17} and now.minute % 1 < self.loop_interval:
if now.hour in {4, 11, 17} and now.minute < self.loop_interval:
match now.hour:
case 11:
# Europe server
Expand All @@ -56,10 +56,9 @@ async def schedule(self) -> None:
if now.minute % 1 < self.loop_interval:
asyncio.create_task(NotesChecker.execute(self.bot))

# Every 30 minutes
if now.minute % 30 < self.loop_interval:
# Every hour
if now.minute < self.loop_interval:
asyncio.create_task(self.bot.translator.push_source_strings())
asyncio.create_task(self.bot.translator.fetch_source_strings())

@schedule.before_loop
async def before_schedule(self) -> None:
Expand Down

0 comments on commit 1e0aaa6

Please sign in to comment.