HTHou commented on code in PR #62:
URL: 
https://github.com/apache/iotdb-client-csharp/pull/62#discussion_r3687978031


##########
src/Apache.IoTDB/SessionPool.cs:
##########
@@ -172,10 +205,61 @@ protected internal SessionPool(List<string> nodeUrls, 
string username, string pa
             _certificatePath = certificatePath;
             _sqlDialect = sqlDialect;
             _database = database;
+            _poolWaitTimeoutInMs = poolWaitTimeoutInMs;
+        }
+        /// <summary>
+        /// Acquires a client from the pool. If the pool has no idle client 
but owns vacant slots left behind
+        /// by earlier failed reconnections, one of those slots is 
re-materialized on the spot instead of
+        /// blocking on a queue that nobody will ever feed. This is what lets 
the pool recover on its own
+        /// after the server has been unreachable for a while.
+        /// </summary>
+        private async Task<Client> AcquireClientAsync(CancellationToken 
cancellationToken = default)
+        {
+            if (_clients.ClientQueue.IsEmpty && TryReserveVacantSlot())

Review Comment:
   [P2] This only rebuilds a vacant slot when the idle queue is completely 
empty. After a full outage, the first successful request creates one connection 
and returns it; under sequential or light workloads, later requests keep 
reusing that connection, so the remaining `VacantSlots` never return to zero 
even though the server is healthy. That also makes the documented alert 
semantics (“steady non-zero means the server is still unreachable”) incorrect. 
Please either refill the remaining capacity after recovery, or explicitly 
define this as demand-driven capacity and adjust the metric/documentation 
accordingly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to