Skip to content

Added ability to enforce max connection lifetime #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

lutovich
Copy link
Contributor

Driver keeps idle network connections in a connection pool. These connections can get invalidated while resting idle in the pool. They can be killed by network equipment like load balancer, proxy or firewall. It is also safer to refresh connections once in a while so that database can renew corresponding resources.

This PR adds maxConnectionLifetime setting and makes driver close too old connections. Checking and closing happens during connection acquisition.

Also removed manual Date.now() mocking in favour of existing library - Lolex.

Driver keeps idle network connections in a connection pool. These
connections can get invalidated while resting idle in the pool.
They can be killed by network equipment like load balancer, proxy or
firewall. It is also safer to refresh connections once in a while so
that database can renew corresponding resources.

This commit adds `maxConnectionLifetime` setting and makes driver
close too old connections. Checking and closing happens during
connection acquisition.

Also removed manual `Date.now()` mocking in favour of
existing library - Lolex.
@lutovich lutovich force-pushed the 1.5-maxConnectionLifetime branch from be86f3a to 2e9415d Compare August 11, 2017 14:55
@@ -19,18 +19,22 @@

import neo4j from '../../src/v1';
import sharedNeo4j from '../internal/shared-neo4j';
import FakeConnection from '../internal/fake-connection';
import lolex from 'lolex';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good addition 👍

@zhenlineo zhenlineo merged commit 28eeba5 into neo4j:1.5 Aug 16, 2017
@lutovich lutovich deleted the 1.5-maxConnectionLifetime branch August 21, 2017 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants