Merge pull request 'fix' (#54) from master into dev

Reviewed-on: #54
This commit is contained in:
emmatveev 2025-06-12 02:39:41 +03:00
commit a0e06d3ef8

View File

@ -52,7 +52,6 @@ def get_hosts() -> list[str]:
f"http://configurator/api/v1/fetch?project=certupdater&stage={os.getenv("STAGE")}" f"http://configurator/api/v1/fetch?project=certupdater&stage={os.getenv("STAGE")}"
).json() ).json()
hosts = response["configs"]["hosts"] hosts = response["configs"]["hosts"]
print(f"got hosts {hosts}")
return list(hosts) return list(hosts)
@ -108,8 +107,10 @@ def update_host(host: str) -> str | None:
while True: while True:
now = datetime.datetime.now() now = datetime.datetime.now()
mongo_hosts = mongo.hosts mongo_hosts = mongo.hosts
hosts = get_hosts()
print(f"got hosts {hosts}")
updated = False updated = False
for host in get_hosts(): for host in hosts:
if ( if (
now + datetime.timedelta(days=14) now + datetime.timedelta(days=14)
> mongo_hosts.get( > mongo_hosts.get(