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

backend: investigate potential issue with not using timezone aware datetime #774

Open
hellais opened this issue Nov 20, 2023 · 0 comments
Open
Assignees
Labels
chore routine tasks that must be done, but require little active brain power priority/low

Comments

@hellais
Copy link
Member

hellais commented Nov 20, 2023

As far as I understand it, we are currently not using timezone aware datetime objects in all of the backend code.

Python 3.12 has deprecated the utcnow() function and it's going to be removed in future versions: https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated.

In 31 places we are calling the since python 3.12 deprecated datetime.utcnow() function:

$ rg --no-filename utcnow | wc -l
      31

While we are at it we should possibly consider if there are other issues related to our use of non-timezone aware functions. For example the clickhouse tables are not specified with the UTC timezone so they will have the timezone set of wherever the machine is run on.

Which is OK since we run all our backend infrastructure on machines that use the UTC timezone, but if that ever changes (maybe because we use some cloud or we are running the code on our laptop) this is going to be a very confusing bug to investigate.

To make things even more annoying, the clickhouse driver we use doesn't work with timezones properly: mymarilyn/clickhouse-driver#388, so we can't easily just switch to using timezone aware functions.

Anyways this issue it to remember about it and think about it when we decide to pick up some refactoring of backend.

@hellais hellais added chore routine tasks that must be done, but require little active brain power priority/low labels Nov 20, 2023
@hellais hellais self-assigned this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore routine tasks that must be done, but require little active brain power priority/low
Projects
None yet
Development

No branches or pull requests

1 participant