Skip to content

Commit 10868b2

Browse files
author
Paul Philion
committed
fixing time specification for daily tasks
1 parent 02e9730 commit 10868b2

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

netbot/netbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from dotenv import load_dotenv
1111
from discord import Role
1212
from discord.ext import commands, tasks
13+
import datetime as dt
14+
from zoneinfo import ZoneInfo
1315

1416
from redmine.model import TicketNote, Ticket, NamedId, Team, TeamSet
1517
from redmine import synctime
@@ -511,7 +513,7 @@ async def recycle_tickets(self):
511513

512514

513515
# The goal is to run the "daily" activities at 10am pacific daily
514-
_ten_am_pacific = synctime.parse_hours("10:00 -0800")
516+
_ten_am_pacific = dt.time(hour=10, tzinfo=ZoneInfo("America/Los_Angeles"))
515517
@tasks.loop(time=_ten_am_pacific)
516518
async def run_daily_tasks(self):
517519
"""Process dusty and recycled tickets.

redmine/synctime.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ 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-
7469
class SyncRecord():
7570
"""encapulates the record of the last ticket syncronization"""
7671
def __init__(self, ticket_id: int, channel_id: int, last_sync: dt.datetime):

0 commit comments

Comments
 (0)