void fail(HttpStatus status, long retryAfterSeconds) {
        this.source = retryAfterSeconds == -1 ? RetryAfterSource.CORE : RetryAfterSource.UPSTREAM;
        this.status = status;
        if (status.is5xx()) {
            if (source == RetryAfterSource.CORE) {
                if (errorCount != 30) {
                    errorCount++;
                }
                retryAfterSeconds = Math.min(1L << errorCount, MAX_BACKOFF_DELAY_SEC);
                setReplyAfter(retryAfterSeconds);
            } else {
                setReplyAfter(retryAfterSeconds);
            }
        } else {
            retryAfterSeconds = source == RetryAfterSource.CORE ? DEFAULT_RETRY_AFTER_SECONDS_VALUE : retryAfterSeconds;
            setReplyAfter(retryAfterSeconds);
            if (status == HttpStatus.TOO_MANY_REQUESTS) {
                log.warn("Upstream {} limit hit: retry after {}", upstream.getEndpoint(), Instant.ofEpochMilli(retryAfter).toString());
            }
        }
    }
Register upstream failure.

@param status response status code from upstream
@param retryAfterSeconds time in seconds when upstream may become available
server/src/main/java/com/epam/aidial/core/server/upstream/UpstreamState.java