This commit is contained in:
lizhuoyu5 2024-11-21 00:09:46 +01:00 committed by GitHub
commit ecd378cc31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 2 deletions

View File

@ -151,7 +151,8 @@ void ConnectionEstablisherAsync::Task::run(AsyncCallback async_callback, Suspend
{ {
connection_establisher_async.reset(); connection_establisher_async.reset();
connection_establisher_async.connection_establisher.setAsyncCallback(async_callback); connection_establisher_async.connection_establisher.setAsyncCallback(async_callback);
connection_establisher_async.connection_establisher.run(connection_establisher_async.result, connection_establisher_async.fail_message); connection_establisher_async.connection_establisher.run(connection_establisher_async.result,
connection_establisher_async.fail_message, connection_establisher_async.force_connected);
connection_establisher_async.is_finished = true; connection_establisher_async.is_finished = true;
} }

View File

@ -76,6 +76,8 @@ public:
const std::string & getFailMessage() const { return fail_message; } const std::string & getFailMessage() const { return fail_message; }
void resumeConnectionWithForceOption(bool force_connected_) {force_connected = force_connected_; resume();}
private: private:
bool checkBeforeTaskResume() override; bool checkBeforeTaskResume() override;
@ -125,6 +127,7 @@ private:
bool is_finished = false; bool is_finished = false;
bool restarted = false; bool restarted = false;
bool force_connected = false;
}; };
#endif #endif

View File

@ -281,7 +281,7 @@ int HedgedConnectionsFactory::getReadyFileDescriptor(bool blocking, AsyncCallbac
HedgedConnectionsFactory::State HedgedConnectionsFactory::resumeConnectionEstablisher(int index, Connection *& connection_out) HedgedConnectionsFactory::State HedgedConnectionsFactory::resumeConnectionEstablisher(int index, Connection *& connection_out)
{ {
replicas[index].connection_establisher->resume(); replicas[index].connection_establisher->resumeConnectionWithForceOption(/*force_connected_*/ shuffled_pools[index].error_count != 0);
if (replicas[index].connection_establisher->isCancelled()) if (replicas[index].connection_establisher->isCancelled())
return State::CANNOT_CHOOSE; return State::CANNOT_CHOOSE;

View File

@ -80,6 +80,7 @@ def _check_exception(exception, expected_tries=3):
for i, line in enumerate(lines[3 : 3 + expected_tries]): for i, line in enumerate(lines[3 : 3 + expected_tries]):
expected_lines = ( expected_lines = (
"Code: 209. " + EXCEPTION_NETWORK + EXCEPTION_TIMEOUT, "Code: 209. " + EXCEPTION_NETWORK + EXCEPTION_TIMEOUT,
"Code: 209. " + EXCEPTION_NETWORK + "Timeout: connect timed out",
EXCEPTION_CONNECT_TIMEOUT, EXCEPTION_CONNECT_TIMEOUT,
EXCEPTION_TIMEOUT, EXCEPTION_TIMEOUT,
) )