neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
853 stars 148 forks source link

Fix connection getting timeout while idle #1167

Closed bigmontz closed 9 months ago

bigmontz commented 9 months ago

When the connection goes idle, an observer is appended. And this causes the receive timeout to start to count. This behaviour causes connections timing out while being idle in the pool.

For fixing this, the connection received methods to handle its status changing to idle and back from idle. When the connection goes idle, it should stop the timeouts and do not start any timeout until it gets busy again.

This change also impacts the hasOngoingRequests method, since idle connections don't have ongoing requests.