Skip to content

Commit b34120e

Browse files
authored
Reduces pool_params::ping_interval default from 1h to 10s (#512)
Improves the detection of broken connections to reduce the chance of handing over broken connections. close #510
1 parent 0661a2b commit b34120e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

include/boost/mysql/pool_params.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ struct pool_params
243243
* Pings will be sent with a periodicity of `ping_interval` until the connection
244244
* is handed to the user, or a ping fails.
245245
*
246+
* Health checks serve two purposes:
247+
*
248+
* \li They prevent connections from closing during period of no activity.
249+
* \li They detect network errors and trigger reconnection. Without health checks,
250+
* you may be handed over connections that are no longer functional, but
251+
* haven't been diagnosed yet.
252+
*
246253
* Set this interval to zero to disable pings.
247254
*
248255
* This value must not be negative. It should be smaller than the server's
@@ -252,7 +259,7 @@ struct pool_params
252259
* session variable). Otherwise, the server might close connections
253260
* without the pool detecting it.
254261
*/
255-
std::chrono::steady_clock::duration ping_interval{std::chrono::hours(1)};
262+
std::chrono::steady_clock::duration ping_interval{std::chrono::seconds(10)};
256263

257264
/**
258265
* \brief The timeout to use for pings and session resets.

0 commit comments

Comments
 (0)