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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use temp file for statement db to avoid connection timeout issues #165

Merged
merged 2 commits into from
Jan 18, 2017

Conversation

yusefnapora
Copy link
Contributor

It seems that knex's connection pool doesn't like in-memory sqlite databases. It's configured to release a connection after an idle timeout, but reopening a connection to :memory: creates a new, empty database. The result is that our unit tests all pass, since they complete before the 30 second timeout, but actually trying to use the db at the repl results in your data getting erased (unless you're an especially fast typist 馃槃)

This just creates a temporary file with the node-temp module and uses it instead of :memory:. I set up node-temp to track and remove temp files at process exit, so we shouldn't be cluttering up the temp directory.

Copy link
Contributor

@parkan parkan left a comment

Choose a reason for hiding this comment

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

Derp. Ok

@yusefnapora yusefnapora merged commit d8cf31d into master Jan 18, 2017
@yusefnapora yusefnapora deleted the yn-fix-db-timeout branch January 18, 2017 16:26
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.

None yet

2 participants