Force_connected for retry resume connection establisher

This commit is contained in:
lzydmxy 2024-10-31 16:09:25 +08:00
parent 9f46c1116a
commit 838408ff0a
3 changed files with 6 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.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;
}

View File

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

View File

@ -281,7 +281,7 @@ int HedgedConnectionsFactory::getReadyFileDescriptor(bool blocking, AsyncCallbac
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())
return State::CANNOT_CHOOSE;