Skip to content
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

feat(server/db): 💾 Add support for connection pool overrides #588

Merged
merged 6 commits into from
Apr 26, 2023

Conversation

0xRaduan
Copy link
Contributor

This pull request is related to the discussion held on https://nango-community.slack.com/archives/C04ABR352H0/p1682452663638319.

While using neon.tech (serverless Postgres DB), I noticed that my compute is always on. After debugging it, I found that the Nango server was causing the issue. After a quick chat with @bastienbeurier, we identified the Knex ORM as the culprit.

As per the Knex ORM docs website, it is important to note that the default value of min is 2 only for historical reasons. It can result in problems with stale connections, despite tarn’s default idle connection timeout of 30 seconds, which is only applied when there are more than min active connections. Therefore, it is recommended to set min: 0 so that all idle connections can be terminated.

Comment on lines 18 to 20
pool: {
min: process.env['NANGO_DB_POOL_MIN'] || 2,
max: process.env['NANGO_DB_POOL_MAX'] || 7
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this code seemed trivial, so I didn't actually test it. Let me know if you want me to test it or there are some automated checks already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't think there are any actual tests. But, it builds.

@bastienbeurier
Copy link
Member

Thanks a lot for pushing this!!

Indeed, we don't have testing in place yet, this is on the roadmap. I'll take some time to test on my side!

@bastienbeurier bastienbeurier merged commit 7fbca22 into NangoHQ:master Apr 26, 2023
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.

2 participants