Move towards a dedicated Duration class (#19223)
We have various constants to try and avoid mistyping of durations, e.g. `ONE_HOUR_SECONDS * MILLISECONDS_PER_SECOND`, however this can get a little verbose and doesn't help with typing. Instead, let's move towards a dedicated `Duration` class (basically a [`timedelta`](https://docs.python.org/3/library/datetime.html#timedelta-objects) with helper methods). This PR introduces the new types and converts all usages of the existing constants with it. Future PRs may work to move the clock methods to also use it (e.g. `call_later` and `looping_call`). Reviewable commit-by-commit.
This commit is contained in:
1
changelog.d/19223.misc
Normal file
1
changelog.d/19223.misc
Normal file
@@ -0,0 +1 @@
|
||||
Move towards using a dedicated `Duration` type.
|
||||
Reference in New Issue
Block a user