arcolight commented on code in PR #7001:
URL: https://github.com/apache/ignite-3/pull/7001#discussion_r2549699494
##########
modules/platforms/cpp/ignite/odbc/sql_connection.cpp:
##########
@@ -802,4 +834,34 @@ void sql_connection::on_observable_timestamp(std::int64_t
timestamp) {
}
}
+void sql_connection::send_heartbeat() {
+ catch_errors([&] {
+ sync_request(protocol::client_operation::HEARTBEAT,
[&](protocol::writer &) {});
+ });
+
+ plan_heartbeat(m_heartbeat_interval);
+}
+
+void sql_connection::on_heartbeat_timeout() {
+ auto idle_for = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - m_last_message_ts);
+
+ if (idle_for > m_heartbeat_interval) {
+ send_heartbeat();
+ } else {
+ auto sleep_for = m_heartbeat_interval - idle_for;
+ plan_heartbeat(sleep_for);
+ }
Review Comment:
Ok, right, makes sense.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]