Skip to content
Snippets Groups Projects
Commit d614b8f9 authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Remove intermediary variables

parent a6baa4de
Branches
Tags
No related merge requests found
Pipeline #64492 passed
...@@ -51,22 +51,20 @@ def matrix_inviter_invite( ...@@ -51,22 +51,20 @@ def matrix_inviter_invite(
r.raise_for_status() r.raise_for_status()
except (requests.ConnectionError, requests.HTTPError) as e: except (requests.ConnectionError, requests.HTTPError) as e:
if r.status_code in (400, 403): if r.status_code in (400, 403):
response_dump = r.json()
order.log_action( order.log_action(
"pretix_matrix_inviter.error", "pretix_matrix_inviter.error",
data={ data={
"matrix_id": user_matrix_id, "matrix_id": user_matrix_id,
"matrix_room": room_matrix_id, "matrix_room": room_matrix_id,
"error": "HTTP Code {} ({})".format( "error": "HTTP Code {} ({})".format(
r.status_code, response_dump["error"] r.status_code, r.json()["error"]
), ),
}, },
) )
else: else:
try: try:
if r.status_code == 429: if r.status_code == 429:
response_dump = r.json() backoff = r.json()["retry_after_ms"] / 1000
backoff = response_dump["retry_after_ms"] / 1000
self.retry(countdown=backoff) self.retry(countdown=backoff)
else: else:
self.retry() self.retry()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment