feat: rotate asset domains automatically on schedule

This commit is contained in:
Iain Learmonth 2023-10-29 19:30:53 +00:00
parent 6e5adb8801
commit c59b1f071f

View file

@ -138,7 +138,7 @@ def auto_deprecate_proxies() -> None:
for proxy in proxies: for proxy in proxies:
if proxy.origin.destroyed is not None: if proxy.origin.destroyed is not None:
proxy.deprecate(reason="origin_destroyed") proxy.deprecate(reason="origin_destroyed")
if proxy.origin_id in current_app.config.get("DAILY_REPLACEMENT_ORIGINS", []): if proxy.origin.assets:
max_age_cutoff = datetime.datetime.utcnow() - datetime.timedelta( max_age_cutoff = datetime.datetime.utcnow() - datetime.timedelta(
days=1, seconds=86400 * random.random()) # nosec: B311 days=1, seconds=86400 * random.random()) # nosec: B311
if proxy.added < max_age_cutoff: if proxy.added < max_age_cutoff: