-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Error reinitializing connection pool #866
Comments
I was having the same issue and my resolution was to call I agree with your statement - having to create a new Knex instance is very difficult and probably a bad practice because you're messing with the module caching. My main concern at this point - if the same instance is being used in separate invocations (due to module caching) and I use This seems like a very dangerous possibility. Ideally there should be a way to use a "stateless" knex instance. My environment is intended to be completely stateless, so having a knex instance where the connection pool is maintained throughout the process (my process does not necessarily exit between requests) is a liability. |
It was mentioned here that since
0.8.x
it should be possible to callknex.initialize()
afterknex.destroy()
to re-initialize a connection pool.However, I am getting the error below:
Using
knex@0.8.6
andsqlite3@3.0.8
.I have created a Gist demonstrating the issue.
It seems that here the
make-knex
utility attempts to call a non-existentinitialize
function on the client object. Is this functionality just not implemented yet, or was I misunderstanding the intention?I could work around this by creating a new Knex instance (and remembering to replace every reference to the previous instance, which is not always straightforward given things like module caching and 3rd party code), but it would simplify things greatly by being able to reuse the same instance and just reinitializing its connection pool.
The text was updated successfully, but these errors were encountered: