Skip to content
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

perf(external_link): cache config #4134

Merged
merged 1 commit into from
Mar 30, 2020

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Feb 19, 2020

What does it do?

This PR add cache for 2 values:

  • EXTERNAL_LINK_(POST|SITE)_ENABLED

Since hexo will only run filter for post or site, it is important to return earlier for another one.

  • EXTERNAL_LINK_(POST|SITE)_CONFIG

Currently, hexo handles hexo.config.external_link inside the filter. With config being cached there will be no need to run Object.assign() again and again.

How to test

git clone -b optimize-external-filter https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@SukkaW SukkaW requested a review from curbengh February 19, 2020 09:01
@SukkaW SukkaW force-pushed the optimize-external-filter branch from 13d4bd3 to d0caac7 Compare February 22, 2020 16:38
@SukkaW SukkaW requested a review from curbengh February 22, 2020 16:38
@SukkaW SukkaW requested a review from a team March 24, 2020 02:43
Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

BTW, we can extract this code into another common function :)

@SukkaW
Copy link
Member Author

SukkaW commented Mar 30, 2020

@yoshinorin

IMHO, we have no necessary to do that.
We already split isExternalLink() into hexo-util. The rest of the code is very specific and no need to split into util.

@SukkaW SukkaW merged commit 68465b6 into hexojs:master Mar 30, 2020
SukkaW added a commit to SukkaW/hexo that referenced this pull request Jun 19, 2020
SukkaW added a commit to SukkaW/hexo that referenced this pull request Jun 19, 2020
@SukkaW SukkaW mentioned this pull request Jun 19, 2020
2 tasks
@SukkaW SukkaW mentioned this pull request Jul 25, 2020
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants