main: use current timezone in favor of utc
This commit is contained in:
parent
0b868e4154
commit
f333fc7e56
9
main.py
9
main.py
@ -21,6 +21,9 @@ class Config(BaseModel):
|
|||||||
def signal_timestamp_to_datetime(timestamp: str) -> datetime.datetime:
|
def signal_timestamp_to_datetime(timestamp: str) -> datetime.datetime:
|
||||||
return datetime.datetime.fromtimestamp(int(timestamp)/1000)
|
return datetime.datetime.fromtimestamp(int(timestamp)/1000)
|
||||||
|
|
||||||
|
def now():
|
||||||
|
return datetime.datetime.now()
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
class Changes[T](BaseModel):
|
class Changes[T](BaseModel):
|
||||||
@ -391,8 +394,8 @@ class LabCleaningBot:
|
|||||||
if is_err(sync_result):
|
if is_err(sync_result):
|
||||||
print(sync_result.unwrap_err())
|
print(sync_result.unwrap_err())
|
||||||
|
|
||||||
for task in get_active_tasks(session, utc_now()):
|
for task in get_active_tasks(session, now()):
|
||||||
reqs = task.create_additional_requests(utc_now(), session)
|
reqs = task.create_additional_requests(now(), session)
|
||||||
|
|
||||||
if is_err(reqs):
|
if is_err(reqs):
|
||||||
if task not in unfulfillable_tasks:
|
if task not in unfulfillable_tasks:
|
||||||
@ -424,7 +427,7 @@ You have time to answer for {format_seconds(task.timeout)}."""
|
|||||||
print(res.unwrap_err())
|
print(res.unwrap_err())
|
||||||
|
|
||||||
# check for timeouts
|
# check for timeouts
|
||||||
for request in task.freshly_expired_requests(datetime.datetime.now()):
|
for request in task.freshly_expired_requests(now()):
|
||||||
print("Request expired:", repr(request))
|
print("Request expired:", repr(request))
|
||||||
message = SendMessageSimple(
|
message = SendMessageSimple(
|
||||||
message="You did not respond to the task request in time.",
|
message="You did not respond to the task request in time.",
|
||||||
|
Loading…
Reference in New Issue
Block a user