All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yandex.ydb.table.utils.RequestSettingsUtils Maven / Gradle / Ivy

There is a newer version: 1.45.6
Show newest version
package com.yandex.ydb.table.utils;

import java.time.Duration;
import java.util.Optional;

import com.yandex.ydb.table.settings.RequestSettings;

public class RequestSettingsUtils {
    public static long calculateDeadlineAfter(RequestSettings settings) {
        Optional clientTimeout = settings.getTimeout();
        if (clientTimeout.isPresent()) {
            if (clientTimeout.get().equals(Duration.ZERO)) {
                return 0;
            }
            return System.nanoTime() + clientTimeout.get().toNanos();
        }
        return settings.getDeadlineAfter();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy