private static long retrieveRetryAfterSeconds(HttpClientResponse response) {
        try {
            String retryAfterHeaderValue = response.getHeader("Retry-After");
            if (retryAfterHeaderValue != null) {
                log.debug("Retry-After header value: {}", retryAfterHeaderValue);
                return Long.parseLong(retryAfterHeaderValue);
            }
            log.debug("Retry-after header not found, status code {}", response.statusCode());
        } catch (Exception e) {
            log.warn("Failed to parse Retry-After header value, fallback to the default value: " + UpstreamState.DEFAULT_RETRY_AFTER_SECONDS_VALUE, e);
        }

        return -1;
    }
@param response http response from upstream
@return the amount of seconds after which upstream should be available or -1 if the value is not provided
server/src/main/java/com/epam/aidial/core/server/upstream/UpstreamRoute.java