Validate challenges in parallel instead of serially. (#617)

This commit is contained in:
Felix Fontein
2023-06-09 06:04:34 +02:00
committed by GitHub
parent 3a5d9129b2
commit d823382732
3 changed files with 27 additions and 2 deletions

View File

@@ -301,3 +301,21 @@ class Authorization(object):
self.status = 'deactivated'
return True
return False
def wait_for_validation(authzs, client):
'''
Wait until a list of authz is valid. Fail if at least one of them is invalid or revoked.
'''
while authzs:
authzs_next = []
for authz in authzs:
authz.refresh(client)
if authz.status in ['valid', 'invalid', 'revoked']:
if authz.status != 'valid':
authz.raise_error('Status is not "valid"', module=client.module)
else:
authzs_next.append(authz)
if authzs_next:
time.sleep(2)
authzs = authzs_next