When connections are requested from the pool in bursts, the pool might have requests in the queue while a keep alive or idle timer is triggered. This should resolve the issue, closes #472.
Currently, I've only implemented a test case to reproduce the behaviour. (The test case is a bit verbose atm, but I wanted to include the full picture for now)
One way to fix it would be to check the request queue in PoolStateMachine.connectionKeepAliveTimerTriggered(_:) and PoolStateMachine.connectionIdleTimerTriggered(_:) instead of a precondition. This can be archived by calling PoolStateMachine.handleAvailableConnection(index:availableContext:) if the queue is not empty.
Maybe this should be handled in ConnectionPool instead?
When connections are requested from the pool in bursts, the pool might have requests in the queue while a keep alive or idle timer is triggered. This should resolve the issue, closes #472.
Currently, I've only implemented a test case to reproduce the behaviour. (The test case is a bit verbose atm, but I wanted to include the full picture for now) One way to fix it would be to check the request queue in
PoolStateMachine.connectionKeepAliveTimerTriggered(_:)
andPoolStateMachine.connectionIdleTimerTriggered(_:)
instead of a precondition. This can be archived by callingPoolStateMachine.handleAvailableConnection(index:availableContext:)
if the queue is not empty. Maybe this should be handled inConnectionPool
instead?Let me know what you think @fabianfett