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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彈 Wait on pending builds during gulp --lazy_build #24214

Merged
merged 1 commit into from Aug 26, 2019
Merged

馃彈 Wait on pending builds during gulp --lazy_build #24214

merged 1 commit into from Aug 26, 2019

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Aug 26, 2019

Today, if a test webpage requests a JS file more than once during gulp --lazy_build, concurrent builds are triggered for the same file, leading to a race.

This PR eliminates the race as follows:

  • Changes the function signature of doBuildJs() to match that of doBuildExtension()
  • Refactors repeated code in lazyBuildExtensions() and lazyBuildJs() into a helper function lazyBuild() that calls the correct build function if necessary
  • Adds a mechanism to lazyBuild() to keep track of and wait for pending builds before serving

This implements the "luxury" version of lazy building mentioned in #24138 (review)

Addresses #24141 (comment)
Partial fix for #24141
Follow up to #24138, #24152, and #24199

@rsimha rsimha self-assigned this Aug 26, 2019
Copy link
Member

@cramforce cramforce left a comment

Choose a reason for hiding this comment

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

Lovely

@cramforce
Copy link
Member

However, one more big update (can be in followup)

Here https://github.com/ampproject/amphtml/blob/master/build-system/tasks/helpers.js#L394

it would be perfect if the pendingBuild promise was set and then removed after the build is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants