ptupitsyn commented on code in PR #6002: URL: https://github.com/apache/ignite-3/pull/6002#discussion_r2137367641
########## modules/platforms/cpp/ignite/client/ignite_client.cpp: ########## @@ -21,22 +21,28 @@ #include <ignite/common/ignite_error.h> -#include <thread> +#include "detail/argument_check_utils.h" namespace ignite { void ignite_client::start_async(ignite_client_configuration configuration, std::chrono::milliseconds timeout, ignite_callback<ignite_client> callback) { // TODO: IGNITE-17762 Async start should not require starting thread internally. Replace with async timer. - auto res = std::async([cfg = std::move(configuration), timeout, callback = std::move(callback)]() mutable { + auto fut = std::async([cfg = std::move(configuration), timeout, callback = std::move(callback)]() mutable { auto res = result_of_operation<ignite_client>([cfg = std::move(cfg), timeout]() { return start(cfg, timeout); }); callback(std::move(res)); }); - UNUSED_VALUE res; + UNUSED_VALUE fut; } ignite_client ignite_client::start(ignite_client_configuration configuration, std::chrono::milliseconds timeout) { + detail::arg_check::container_non_empty(configuration.get_endpoints(), "Connection endpoint list"); + + if (configuration.get_heartbeat_interval().count() < 0) { + throw ignite_error(error::code::ILLEGAL_ARGUMENT, "Heartbeat interval can not be negative"); Review Comment: What if it is `0`? ########## modules/platforms/cpp/ignite/client/ignite_client_configuration.h: ########## @@ -132,14 +138,41 @@ class ignite_client_configuration { [[nodiscard]] uint32_t get_connection_limit() const { return m_connection_limit; } /** - * Set connection limit. + * Set the connection limit. * - * @see GetConnectionsLimit for details. + * @see get_connections_limit for details. * * @param limit Connections limit to set. */ void set_connection_limit(uint32_t limit) { m_connection_limit = limit; } + /** + * Get a heartbeat interval. + * When server-side idle timeout is not zero, the effective heartbeat interval is set to + * min(heartbeat_interval, idle_timeout / 3) + * + * When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically + * to keep the connection alive and detect potential half-open state. + * + * Zero value means heartbeats are disabled. + * + * The default value is DEFAULT_HEARTBEAT_INTERVAL. + * + * @return Heartbeat interval. + */ + [[nodiscard]] std::chrono::microseconds get_heartbeat_interval() const { return m_heartbeat_interval; } + + /** + * Set a heartbeat interval. + * + * @see get_heartbeat_interval for details. + * + * @param heartbeat_interval Heartbeat interval. + */ + void set_heartbeat_interval(std::chrono::microseconds heartbeat_interval) { + m_heartbeat_interval = heartbeat_interval; Review Comment: Should we validate here instead of later on client start? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org