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

Replace blocking fs.readFileSync with non blocking fs.readFile in checkForChanges.js #5791

Merged

Conversation

danielcondemarin
Copy link
Contributor

What did you implement:

Closes: N/A

This PR implements a TODO that was left in checkForChanges.js > checkIfDeploymentIsNecessary which makes reading the zipFiles asynchronously, therefore should make checkForChanges run a bit faster, specially considering there is already a costly blocking operation after the read to compute the checksum per zipFile.

How did you implement it:

Simply replaced blocking fs.readFileSync with non blocking fs.readFile.

How can we verify it:

N/A

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@danielcondemarin danielcondemarin changed the title Read files before hashing asynchronously on checkIfDeploymentIsNecessary replace blocking fs.readFileSync with non blocking fs.readFile on checkForChanges Feb 4, 2019
@danielcondemarin danielcondemarin changed the title replace blocking fs.readFileSync with non blocking fs.readFile on checkForChanges replace blocking fs.readFileSync with non blocking fs.readFile in checkForChanges.js Feb 4, 2019
@pmuens pmuens self-assigned this Feb 5, 2019
Copy link
Contributor

@pmuens pmuens left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @danielcondemarin 👍

Just tested it and it works fine --> LGTM :shipit:

@pmuens pmuens changed the title replace blocking fs.readFileSync with non blocking fs.readFile in checkForChanges.js Replace blocking fs.readFileSync with non blocking fs.readFile in checkForChanges.js Feb 5, 2019
@pmuens pmuens merged commit bc9cb08 into serverless:master Feb 7, 2019
@pmuens pmuens added this to the 1.38.0 milestone Feb 7, 2019
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.

2 participants