-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
feat(core): emit warning when serialization of module is slow #12739
Merged
kamilmysliwiec
merged 2 commits into
nestjs:master
from
h4ad-forks:feat/emit-warning-for-heavier-modules
Nov 17, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
I wonder if 10ms is too small
Can you patch this in some real world project just to see if you'll get the warning? I don't have a good nestjs app using v10 :/
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.
I also don't have a good project with v10, @jmcdo29 or @Tony133, can you give some help about this?
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.
Interestingly, I'm not seeing all of the modules here that I would expect. ButI got no warnings with 10ms as the check time.Added a
console.log({ timeSpentInMs, opaqueToken })
to see what we're looking at hereEverything looks pretty fast here.
I did force it to error by setting the time to be greater than to
0
and this is what the output looks likeDo we want to emit full warnings or just write logs here about it?
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.
I don't know if I have access to
Logger
in that part of the code, I prefer to use logger but if we don't have access, emitWarning is the best option for me.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.
To me, as this is all about internal stuff that may not be fixable, I prefer the emitWarning
But we could emit it only if
NEST_DEBUG
is enabled. What do you think?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.
I don't like to hide it behind a flag because how the people who are having this issue will know about this flag?
I prefer to leave it as directly as possible, and maybe only add a flag to disable it.
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.
We can drop a logger in here and use the

warn
level, as technically devs can work to make the opaque token lighter. This is what the logs look like usingogma
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.
I will push a update to use
Logger
in this case, which I think is way better than emitWarning.