diff --git a/src/Apache.IoTDB/SessionPool.cs b/src/Apache.IoTDB/SessionPool.cs index bbe2d18..b2bec95 100644 --- a/src/Apache.IoTDB/SessionPool.cs +++ b/src/Apache.IoTDB/SessionPool.cs @@ -113,6 +113,20 @@ public SessionPool(List nodeUrls, string username, string password, int public async Task ExecuteClientOperationAsync(AsyncOperation operation, string errMsg, bool retryOnFailure = true) { Client client = _clients.Take(); + Func> executeWithReconnect = async (currentClient) => + { + try + { + currentClient = await Reconnect(currentClient); + var response = await operation(currentClient); + return response; + } + catch (TException retryEx) + { + throw new TException(errMsg, retryEx); + } + }; + try { var resp = await operation(client); @@ -122,16 +136,18 @@ public async Task ExecuteClientOperationAsync(AsyncOperation