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

refactor(v2): avoid synchronous/ blocking operation when possible #1957

Merged
merged 2 commits into from
Nov 11, 2019

Conversation

endiliey
Copy link
Contributor

Motivation

Refactoring. Try to avoid fs sync operation since it blocks the whole nodejs thread loop.

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

  • Updated test passes
  • Netlify
  • Build still works
    (20s-21s)

after 20s

after  21s

- Development

dev

@endiliey endiliey added better engineering Not a bug or feature request 2.x labels Nov 11, 2019
@endiliey endiliey changed the title perf(v2): avoid synchronous/ blocking operation when possible refactor(v2): avoid synchronous/ blocking operation when possible Nov 11, 2019
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 11, 2019
@@ -105,7 +104,7 @@ function normalizeSidebar(sidebars: SidebarRaw): Sidebar {
export default function loadSidebars(sidebarPath: string): Sidebar {
// We don't want sidebars to be cached because of hotreloading.
let allSidebars: SidebarRaw = {};
if (sidebarPath && fs.existsSync(sidebarPath)) {
if (sidebarPath) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, if fake path is given, it is simply ignored

@endiliey endiliey added pr: polish This PR adds a very minor behavior improvement that users will enjoy. and removed 2.x better engineering Not a bug or feature request labels Nov 11, 2019
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Nov 11, 2019

Deploy preview for docusaurus-2 ready!

Built with commit 3c8475b

https://deploy-preview-1957--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Nov 11, 2019

Deploy preview for docusaurus-preview ready!

Built with commit 3c8475b

https://deploy-preview-1957--docusaurus-preview.netlify.com

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

I think making the code more parallel might introduce obscure race conditions and I'm not convinced we are aware of them. Your call to merge :P

@endiliey endiliey merged commit 1235fc9 into master Nov 11, 2019
@endiliey endiliey deleted the endi/avoidsynchronous branch November 11, 2019 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants