private void updateUpstreamCache(HttpClientResponse proxyResponse, Model model) {
        String breakpointPath = proxyResponse.getHeader(Proxy.HEADER_CACHE_BREAKPOINT_PATH);
        if (breakpointPath == null) {
            // no cache
            return;
        }
        String hash = upstreamCacheContext == null ? null : upstreamCacheContext.getPrefixToHash().get(breakpointPath);
        if (hash == null) {
            if (model.getType() == ModelType.CHAT) {
                log.warn("prefix is not found: {}", breakpointPath);
            }
            return;
        }
        String expireAt = proxyResponse.getHeader(Proxy.HEADER_CACHE_EXPIRE_AT);
        String extraMetadata = proxyResponse.getHeader(Proxy.HEADER_CACHE_EXTRA_METADATA);
        CachedUpstreamEntry entry = new CachedUpstreamEntry(upstream.getEndpoint(), breakpointPath, extraMetadata);
        vertx.executeBlocking(() -> {
            upstreamCacheService.updateEntry(hash, entry, model, expireAt);
            return null;
        }, false).onFailure(error -> log.error("Error occurred while updating cached upstream entry", error));
    }
Fail current upstream due to error

@param status - response http status; typically, 5xx or 429
@param retryAfterSeconds - the amount of seconds after which upstream should be available
server/src/main/java/com/epam/aidial/core/server/upstream/UpstreamRoute.java