2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 06:35:33 +00:00

Only ask a second time when the bmc might answer differently

Retrying a refusal three times over nine seconds only delayed the fallback
meant for it.
This commit is contained in:
Markus Hilger
2026-08-14 17:43:31 +02:00
parent 2ba5119f44
commit 055434a862
@@ -32,6 +32,19 @@ from datetime import timedelta
from dateutil import tz
import socket
def _maybe_transient(theexc):
"""Whether a request might succeed if it were simply asked again.
A bmc that answered and refused has given its answer. Only one that did
not answer, or said it ran out of time, is worth asking twice.
"""
if isinstance(theexc, (asyncio.TimeoutError, OSError)):
return True
text = str(theexc).lower()
return 'timeout' in text or 'timed out' in text
def _pem_to_dict(pemdata, uefi=False):
"""Pull PEM into a dict
@@ -777,6 +790,10 @@ class OEMHandler(object):
except Exception as de:
if delerr is None:
delerr = de
if not _maybe_transient(de):
# It answered and refused, and the fallback below is what
# that is for
break
await asyncio.sleep(3)
if not await fishclient._account_url_info_by_id(uid):
return True