-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Update dbConnect.js #19644
Merged
Merged
Update dbConnect.js #19644
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
mustafaKamal-fe
requested review from
chibicode,
ijjk,
lfades,
Timer and
timneutkens
as code owners
November 29, 2020 01:33
Stats from current PRDefault Server Mode (Decrease detected ✓)General
Page Load Tests Overall decrease
|
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.009 | 1.985 | -0.02 |
/ avg req/sec | 1244.29 | 1259.16 | +14.87 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.128 | 1.142 | |
/error-in-render avg req/sec | 2215.98 | 2188.83 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-90b3d5a..55ad.js gzip | 6.54 kB | 6.54 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 621 B | 621 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Serverless Mode
General
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 10.5s | 10.3s | -194ms |
nodeModulesSize | 85 MB | 85 MB | ✓ |
Client Bundles (main, webpack, commons)
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-90b3d5a..55ad.js gzip | 6.54 kB | 6.54 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Serverless bundles
vercel/next.js canary | mustafaKamal-fe/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 996 kB | 996 kB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 996 kB | 996 kB | ✓ |
link.js | 1.05 MB | 1.05 MB | ✓ |
routerDirect.js | 1.04 MB | 1.04 MB | ✓ |
withRouter.js | 1.04 MB | 1.04 MB | ✓ |
Overall change | 5.13 MB | 5.13 MB | ✓ |
lfades
reviewed
Dec 30, 2020
lfades
approved these changes
Dec 30, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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