Skip to content

Commit

Permalink
feat: Better automatic registration logging
Browse files Browse the repository at this point in the history
  • Loading branch information
m-horky committed Sep 23, 2024
1 parent 12b3bda commit dc31ee3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/subscription_manager/scripts/rhsmcertd_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,20 @@ def _auto_register_anonymous(uep: "UEPConnection", token: Dict[str, str]) -> Non
log.debug(report)
return
except connection.RateLimitExceededException as exc:
if exc.headers.get("Retry-After", None) is None:
if exc.retry_after is None:
log.warning(
"Server did not include Retry-After header in rate-limited response. "
f"headers={exc.headers}"
)
raise
delay = int(exc.headers["Retry-After"])
delay = exc.retry_after
log.debug(
f"Got response with status code {exc.code} and Retry-After header, "
f"will try again in {delay} seconds."
)
time.sleep(delay)
except Exception:
except Exception as exc:
log.warning(f"Anonymous registration failed, server returned {exc}.")
raise

# In theory, this should not happen, it means that something has gone wrong server-side.
Expand Down

0 comments on commit dc31ee3

Please sign in to comment.