mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Handle Apple's trash servers when polling for notarization
Apple's servers have a gateway timeout a small but noticeable percentage of the time, which was breaking the script. Detect such Apple flakiness and keep trying.
This commit is contained in:
parent
09372994bb
commit
5530ec3057
|
@ -68,24 +68,27 @@ while not done:
|
||||||
'--notarization-info', uuid,
|
'--notarization-info', uuid,
|
||||||
*userpass,
|
*userpass,
|
||||||
'--output-format', 'xml'
|
'--output-format', 'xml'
|
||||||
], stdout=subprocess.PIPE)
|
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
result.check_returncode()
|
if result.returncode == 1 and b'Gateway Timeout' in result.stderr:
|
||||||
data = plistlib.loads(result.stdout)
|
status = "Apple's servers are trash (aka Gateway Timeout)"
|
||||||
if 'notarization-info' not in data or 'Status' not in data['notarization-info']:
|
|
||||||
status = 'Request failed'
|
|
||||||
else:
|
else:
|
||||||
status = data['notarization-info']['Status Message'] if 'Status Message' in data['notarization-info'] else ''
|
result.check_returncode()
|
||||||
st = data['notarization-info']['Status']
|
data = plistlib.loads(result.stdout)
|
||||||
if st == 'success':
|
if 'notarization-info' not in data or 'Status' not in data['notarization-info']:
|
||||||
success = True
|
status = 'Request failed'
|
||||||
done = True
|
else:
|
||||||
elif st == 'invalid':
|
status = data['notarization-info']['Status Message'] if 'Status Message' in data['notarization-info'] else ''
|
||||||
done = True
|
st = data['notarization-info']['Status']
|
||||||
elif st == 'in progress' and len(status) == 0:
|
if st == 'success':
|
||||||
status = 'Notarization in progress'
|
success = True
|
||||||
|
done = True
|
||||||
|
elif st == 'invalid':
|
||||||
|
done = True
|
||||||
|
elif st == 'in progress' and len(status) == 0:
|
||||||
|
status = 'Notarization in progress'
|
||||||
|
|
||||||
if done and 'LogFileURL' in data['notarization-info']:
|
if done and 'LogFileURL' in data['notarization-info']:
|
||||||
status += '\n\nlog file: {}'.format(data['notarization-info']['LogFileURL'])
|
status += '\n\nlog file: {}'.format(data['notarization-info']['LogFileURL'])
|
||||||
|
|
||||||
elapsed = time.time() - started_waiting
|
elapsed = time.time() - started_waiting
|
||||||
mins, secs = int(elapsed // 60), int(elapsed % 60)
|
mins, secs = int(elapsed // 60), int(elapsed % 60)
|
||||||
|
|
Loading…
Reference in a new issue