From 6652360d3044b77caa27f8b09e2beedeb078a794 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 11 Dec 2024 07:46:09 -0300 Subject: [PATCH] souphttpsrc: Retry on SERVICE_UNAVAILABLE and INTERNAL_SERVER_ERROR Those might be temporary issue, for example s3 returns SERVICE_UNAVAILABLE high load, but afterward a few tries the request will work, and it has been observed that internal server error sometimes "fix themselves" so it makes sense to also retry requests, in case. Part-of: --- .../gst-plugins-good/ext/soup/gstsouphttpsrc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c index f84a7f40ae..d7155dd181 100644 --- a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c +++ b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c @@ -1695,6 +1695,19 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) } #endif + switch (status_code) { + case SOUP_STATUS_SERVICE_UNAVAILABLE: + case SOUP_STATUS_INTERNAL_SERVER_ERROR: + if (src->max_retries == -1 || src->retry_count < src->max_retries) { + return GST_FLOW_CUSTOM_ERROR; + } + /* Error out when max_retries is reached. */ + break; + default: + break; + } + + if (SOUP_STATUS_IS_CLIENT_ERROR (status_code) || SOUP_STATUS_IS_REDIRECTION (status_code) || SOUP_STATUS_IS_SERVER_ERROR (status_code)) {