-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
CLI Command opening new db connection for every route #61
Comments
When reading the sitemap functions in each route, are they done in parrallel or in squence? |
These two lines sitemaps.ts:150, sitemaps.ts:167, while they are not the direct cause, they will exassurbate the issue, because it means it will attempt to run the Then since I have 207 different routes, it will open only 10 connections and as each query completes it will then schedule another awaiting one on the new open available connection, but the time it gets near to the end it starts timing out because the queries aren't able to be executed on a db connection. I'll make a PR implementing a rate limiter which reads from a config to limit the promise all execution based on a config varaible if present |
With further testing this issue does occur when using prisma = getClient(); Instead of if (!global.__db__) {
global.__db__ = getClient();
}
prisma = global.__db__; Which implies that global variables shared between different files importing it are not actually being shared, and multiple unique instances are being loaded. The update in the PR does mitigate the issue a bit |
Describe the bug
For every route the npm task opens a new database connection instead of continuing to use the existing one from other routes.
Almost every single route imports
~/db.server.ts
which is where the database connection is initalizedInterestingly this only occurs when running on the production server, but not in my local environment which is extra odd.
The text was updated successfully, but these errors were encountered: