private long determineTimeout()

in data/src/main/java/com/microsoft/azure/kusto/data/ClientImpl.java [415:444]


    private long determineTimeout(ClientRequestProperties properties, CommandType commandType, String clusterUrl) {
        Object skipBoolean = properties.getOption(ClientRequestProperties.OPTION_NO_REQUEST_TIMEOUT);
        if (skipBoolean instanceof Boolean && (Boolean) skipBoolean) {
            return Long.MAX_VALUE;
        }

        Long timeoutMs;
        try {
            timeoutMs = properties.getTimeoutInMilliSec();
        } catch (ParseException e) {
            throw new DataClientException(clusterUrl, "Failed to parse timeout from ClientRequestProperties");
        }

        if (timeoutMs == null) {
            switch (commandType) {
                case ADMIN_COMMAND:
                    timeoutMs = COMMAND_TIMEOUT_IN_MILLISECS;
                    break;
                case STREAMING_INGEST:
                    timeoutMs = STREAMING_INGEST_TIMEOUT_IN_MILLISECS;
                    break;
                default:
                    timeoutMs = QUERY_TIMEOUT_IN_MILLISECS;
            }
        }
        // If we set the timeout ourself, we need to update the server header
        properties.setTimeoutInMilliSec(timeoutMs);

        return timeoutMs + CLIENT_GRACE_PERIOD_IN_MILLISECS;
    }