From 0cb50f1023c394ba3e51e70a5daa2aea417cea5d Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Wed, 2 Jan 2019 12:04:53 -0500 Subject: SERVER-37880 Make time_support's Backoff class non-blocking --- src/mongo/client/dbclient_connection.cpp | 4 ++-- src/mongo/client/dbclient_connection.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mongo/client') diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index 4f1c8acac54..7ccfdcc0347 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -445,7 +445,7 @@ void DBClientConnection::_checkConnection() { throwSocketError(SocketErrorKind::FAILED_STATE, toString()); // Don't hammer reconnects, backoff if needed - autoReconnectBackoff.nextSleepMillis(); + sleepFor(_autoReconnectBackoff.nextSleep()); LOG(_logLevel) << "trying reconnect to " << toString() << endl; string errmsg; @@ -546,7 +546,7 @@ DBClientConnection::DBClientConnection(bool _autoReconnect, MongoURI uri, const HandshakeValidationHook& hook) : autoReconnect(_autoReconnect), - autoReconnectBackoff(1000, 2000), + _autoReconnectBackoff(Seconds(1), Seconds(2)), _hook(hook), _uri(std::move(uri)) { _numConnections.fetchAndAdd(1); diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h index d7d58150257..3b55f3d2b22 100644 --- a/src/mongo/client/dbclient_connection.h +++ b/src/mongo/client/dbclient_connection.h @@ -304,7 +304,7 @@ protected: AtomicWord _stayFailed{false}; AtomicWord _failed{false}; const bool autoReconnect; - Backoff autoReconnectBackoff; + Backoff _autoReconnectBackoff; HostAndPort _serverAddress; std::string _resolvedAddress; -- cgit v1.2.1