Skip to content

Commit

Permalink
Handle 429 in httpjson logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ekouts committed Dec 20, 2024
1 parent 6028f1c commit 120cf87
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions reframe/core/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,18 @@ def emit(self, record):
return

try:
response = requests.post(
self._url, data=json_record,
headers=self._headers
)
if response.status_code != 200:
while True:
response = requests.post(
self._url, data=json_record,
headers=self._headers
)
if response.status_code == 200:
break

if response.status_code == 429:
time.sleep(1)
continue

raise LoggingError(
f'logging failed: HTTP response code '
f'{response.status_code}'
Expand Down

0 comments on commit 120cf87

Please sign in to comment.