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
WriteConflict under MongoDB #97
Comments
Perhaps this is the result of using multiple prisma clients? E.g, one passed to the PrismaSessionStore constructor, other(s) for other backend functionality? The one passed to the PrismaSessionStore constructor has a "background process" checking to see if sessions have expired; perhaps the conflict is related to this check? (Just a paranoid theory; I haven't looked at the code.) Also - not using a separate prisma client for the |
Double checked and I'm sure that only 1 prisma client is present.
That's frowned upon by Prisma themselves so probably not a great thing to have to put up with. |
Just had a brainwave, could this be caused by the fact that this library manually calls prisma.$connect? Edit: seemingly not |
Guessing not... But maybe?
@SunburntRock89 - Earlier, you wrote:
Curious: If Prisma is recommending using a single instance of PrismaClient, why is it frowned upon to pass an existing prisma client from back-end code to the prisma-session-store library code? |
Sorry, can see why that statement might be confusing. I meant that creating multiple clients was frowned upon because you implied doing that. |
Ah - got it. I suppose one wrinkle is that some people (not all) report issues (I believe Typescript typing issues) when they try to pass a pre-existing prisma client to the |
Yeah, multiple clients shouldn't be an issue regardless, it's just a connection pooling thing iirc. Making multiple pools means far more connections, some of which won't be touched at all. It's probably more a thing of trying to prevent people from making a new connection pool for every single part of their app. |
Thanks @SunburntRock89; good to get your sense of this... |
@kleydon Whilst we (were) here, do you happen to know why, when there's no updateMany queries in the session store code, logging queries in prisma returns several updateMany queries to the Session table? Another thing: |
Good question. Guessing prisma is doing something "under the hood", but I'm not 100% certain. |
I'll add an issue for considering this. It's unclear to me whether there are circumstances where this might "lock things down" too much, or not. |
Simply navigating to any page gives me
Presumably there's multiple update commands being ran at the same time?
The text was updated successfully, but these errors were encountered: