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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8128>
This commit is contained in:
Thibault Saunier 2024-12-11 07:46:09 -03:00 committed by GStreamer Marge Bot
parent 99ad918ece
commit 6652360d30

View file

@ -1695,6 +1695,19 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
} }
#endif #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) || if (SOUP_STATUS_IS_CLIENT_ERROR (status_code) ||
SOUP_STATUS_IS_REDIRECTION (status_code) || SOUP_STATUS_IS_REDIRECTION (status_code) ||
SOUP_STATUS_IS_SERVER_ERROR (status_code)) { SOUP_STATUS_IS_SERVER_ERROR (status_code)) {