Skip to content

Commit 42fcade

Browse files
author
Paul Philion
committed
updating tasks to run at 10am daily
1 parent 0e131fe commit 42fcade

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

netbot/netbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ async def recycle_tickets(self):
510510
await self.recycle_ticket(ticket)
511511

512512

513-
@tasks.loop(hours=24)
513+
# The goal is to run the "daily" activities at 10am pacific daily
514+
_ten_am_pacific = synctime.parse_hours("10:00 PT")
515+
@tasks.loop(time=_ten_am_pacific)
514516
async def run_daily_tasks(self):
515517
"""Process dusty and recycled tickets.
516518
Expected to run every 24 hours to:

redmine/synctime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ def zulu(timestamp:dt.datetime) -> str:
6666
return timestamp.strftime(ZULU_FORMAT)
6767

6868

69+
def parse_hours(hour_str:str) -> dt.time:
70+
"""convert '10:00 PT' into a time-of-day object"""
71+
return dt.datetime.strptime(hour_str, "%H:%M %z").time()
72+
73+
6974
class SyncRecord():
7075
"""encapulates the record of the last ticket syncronization"""
7176
def __init__(self, ticket_id: int, channel_id: int, last_sync: dt.datetime):

0 commit comments

Comments
 (0)