Update dbConnect.js (#19644)
* Update dbConnect.js The previous logic was in my opinion prone to errors in situations when different calls to this function from different locations may happen at the same time ( like a race condition ). If the readyState is anything but not 0, then we must not try to perform a new connection as this may cause consequent connections! I hope this makes sense * Update examples/with-mongodb-mongoose/utils/dbConnect.js * Lint fix and minor changes Co-authored-by:Luis Alvarez D <luis@vercel.com> Co-authored-by:
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment