-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WIP: perf(router): avoid calling set
when the generated data unmodified
#5482
base: master
Are you sure you want to change the base?
Conversation
How to testgit clone -b perf/router-refresh https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test |
Now green. Use unique files for each test for watch. Because using the same files ( |
Pull Request Test Coverage Report for Build 8870147837Details
💛 - Coveralls |
set
when the generated data unmodifiedset
when the generated data unmodified
hexo.unwatch(); // Stop watching | ||
await unlink(target); // Delete the file | ||
} | ||
|
||
it('watch() - source', async () => await testWatch(hexo.source_dir)); | ||
it('watch() - source', async () => await testWatch(hexo.source_dir, 'source.test.watch.txt')); |
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 changed it to use unique files for each test for watch. Because using the same files (test.txt
) as other tests caused failures. Perhaps caused by caching or something similar, but I'm not sure.
set
when the generated data unmodifiedset
when the generated data unmodified
I've noticed that when |
It seems that the |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore |
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.
Always prefer // @ts-expect-error
, do not use // @ts-ignore
What does it do?
When any file is modified, even unchanged routes are updated (the
set
method is called). Additionally, in theset
method, EventEmitter's emit is called. So, events to be fired many times (number of assets) whenever a single file is updated.Maybe, it should be fine to call the
set
method only for the modified files.Screenshots
N/A
Pull request tasks