Skip to content

Conversation

delvedor
Copy link
Member

This pr introduces two changes in the internals of the client:

The ConnectionPool.getConnection method now always returns a connection

Until now, the ConnectionPool.getConnection was returning null if there were no longer alive connections; while this solution makes sense, in some cases might cause an endless loop of failures, as running a sniff for refreshing the node list would be impossible.
There is still a case where the ConnectionPool.getConnection returns null, which happens if the filter/selector returns no nodes. For improving the debugging experience, the NoLivingConnectionsError error message has been updated.

The ConnectionPool.update method now cleans the dead list

It can happen in a situation where we are updating the connections list and running sniff, leaving the dead list in a dirty state. Now the ConnectionPool.update cleans up the dead list every time, which makes way more sense given that all the new connections are alive.
Fixes: #1122.

- The ConnectionPool.getConnection method now always returns a connection
- The ConnectionPool.update mehtod now cleans the dead list
- Deprecated the NoLivingConnectionsError
@delvedor delvedor merged commit f913f7d into master Mar 26, 2020
@delvedor delvedor deleted the improve-bad-connections branch March 26, 2020 12:41
github-actions bot pushed a commit that referenced this pull request Mar 26, 2020
* Updated Connections handling

- The ConnectionPool.getConnection method now always returns a connection
- The ConnectionPool.update mehtod now cleans the dead list
- Deprecated the NoLivingConnectionsError

* Updated test

* Updated docs

* The NoLivingConnectionsError can still happen if the filter/selector returns no nodes

* Updated test

* Updated docs

* Catch undefined connections as well

* Updated test

* Updated ApiError type def
delvedor added a commit that referenced this pull request Mar 26, 2020
* Updated Connections handling

- The ConnectionPool.getConnection method now always returns a connection
- The ConnectionPool.update mehtod now cleans the dead list
- Deprecated the NoLivingConnectionsError

* Updated test

* Updated docs

* The NoLivingConnectionsError can still happen if the filter/selector returns no nodes

* Updated test

* Updated docs

* Catch undefined connections as well

* Updated test

* Updated ApiError type def
delvedor added a commit that referenced this pull request Jul 30, 2020
* Updated Connections handling

- The ConnectionPool.getConnection method now always returns a connection
- The ConnectionPool.update mehtod now cleans the dead list
- Deprecated the NoLivingConnectionsError

* Updated test

* Updated docs

* The NoLivingConnectionsError can still happen if the filter/selector returns no nodes

* Updated test

* Updated docs

* Catch undefined connections as well

* Updated test

* Updated ApiError type def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot read property 'resurrectTimeout' of undefined
2 participants