Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler stops due to Timezone Mismatch #724

Closed
mbelletti opened this issue Dec 6, 2024 · 0 comments · Fixed by #725
Closed

Scheduler stops due to Timezone Mismatch #724

mbelletti opened this issue Dec 6, 2024 · 0 comments · Fixed by #725

Comments

@mbelletti
Copy link
Contributor

mbelletti commented Dec 6, 2024

After recent updates, tasks occasionally fail to execute and the scheduler stops picking up new tasks. The issue appears to be related in the use of utcnow in the scheduler now function.

Previous behaviour:

datetime.datetime.utcnow()

datetime.datetime(2024, 12, 6, 10, 9, 42, 309311)

Current behavior from utcnow return timezone information:

datetime.datetime.now(datetime.timezone.utc)

datetime.datetime(2024, 12, 6, 9, 49, 34, 431457, tzinfo=datetime.timezone.utc)

that is the errror:

Exception in thread Thread-2 (loop):
Traceback (most recent call last):
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/max/.pyenv/versions/py4web_3.10.2/lib/python3.10/site-packages/pydal/tools/scheduler.py", line 184, in loop
    if not self.step():
  File "/Users/max/.pyenv/versions/py4web_3.10.2/lib/python3.10/site-packages/pydal/tools/scheduler.py", line 210, in step
    if run.timeout and run.started_on + delta(run.timeout) < now():
TypeError: can't compare offset-naive and offset-aware datetimes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant