[FIX] runbot: add timeout to request

For a strange reason, the runbot got stuck while updating a ci status.
The reason why it occurs know just after the upgrade is unknown, but
adding a timeout may help to mitigate this issue.
This commit is contained in:
Xavier-Do 2024-12-16 15:56:36 +01:00 committed by Christophe Monniez
parent 881941988b
commit 09b14e1702

View File

@ -278,9 +278,9 @@ class Remote(models.Model):
while try_count < nb_tries: while try_count < nb_tries:
try: try:
if payload: if payload:
response = session.post(url, data=json.dumps(payload)) response = session.post(url, data=json.dumps(payload), timeout=20)
else: else:
response = session.get(url) response = session.get(url, timeout=20)
response.raise_for_status() response.raise_for_status()
if try_count > 0: if try_count > 0:
_logger.info('Success after %s tries', (try_count + 1)) _logger.info('Success after %s tries', (try_count + 1))