fix: revert use of dt.UTC to dt.tz.UTC

some instance still on python 3.9
This commit is contained in:
Iain Learmonth 2024-11-29 18:53:46 +00:00
parent 905bdd1a58
commit cdbf152f40
4 changed files with 10 additions and 10 deletions

View file

@ -155,7 +155,7 @@ def auto_deprecate_proxies() -> None:
.all())
logging.debug("Max age: %s", max_age_proxies)
for proxy in max_age_proxies:
max_age_cutoff = datetime.datetime.now(datetime.UTC) - datetime.timedelta(
max_age_cutoff = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(
days=1, seconds=86400 * random.random()) # nosec: B311
if proxy.added < max_age_cutoff:
proxy.deprecate(reason="max_age_reached")
@ -168,7 +168,7 @@ def destroy_expired_proxies() -> None:
This function finds all proxies that are not already destroyed and have been deprecated for more than 4 days.
It then destroys these proxies.
"""
expiry_cutoff = datetime.datetime.utcnow() - datetime.timedelta(days=4)
expiry_cutoff = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=4)
proxies = Proxy.query.filter(
Proxy.destroyed.is_(None),
Proxy.deprecated < expiry_cutoff