Reduce connection check interval and make configurable

The previous 1s default seems on the long side; this reduces it to
250ms.  It also makes it a public member so that it can be configured
(which is mainly needed for the test suite, but might be useful for
lokimq-calling code that needs faster or slower connection cleanups).
This commit is contained in:
Jason Rhinelander 2020-03-23 22:29:14 -03:00
parent b97f3442e7
commit 75750001ce
1 changed files with 8 additions and 3 deletions

View File

@ -71,9 +71,6 @@ template <typename R> class Batch;
*/
static constexpr auto DEFAULT_SEND_KEEP_ALIVE = 30s;
// How frequently we cleanup connections (closing idle connections, calling connect or request failure callbacks)
static constexpr auto CONN_CHECK_INTERVAL = 1s;
// The default timeout for connect_remote()
static constexpr auto REMOTE_CONNECT_TIMEOUT = 10s;
@ -202,6 +199,14 @@ public:
* after the high-level zmq socket is closed. */
std::chrono::milliseconds CLOSE_LINGER = 5s;
/** How frequently we cleanup connections (closing idle connections, calling connect or request
* failure callbacks). Making this slower results in more "overshoot" before failure callbacks
* are invoked; making it too fast results in more proxy thread overhead. Any change to this
* variable must be set before calling start().
*/
std::chrono::milliseconds CONN_CHECK_INTERVAL = 250ms;
private:
/// The lookup function that tells us where to connect to a peer, or empty if not found.