Fix project upload auto-deploy race condition #1122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description and Context
This fixes a race condition in the way that we handle project autodeploys. Currently, our backend will skip the autodeploy for a successful build if there is another build currently in progress for that same project.
You can easily reproduce this by:
hs project upload
in both windows at the same time (within a second or two should be enough)This should result in the first window hanging on the "build succeeded" step indefinitely. The second instance should build and deploy as expected.
I fixed this by breaking out the polling for the auto deploy information into its own dedicated step. Now, the build polling logic will exit as soon as the build status is either success or failure. At that point we'll check to see if we need to poll for auto deploy information. From my testing, the autodeploy information is usually immediately available so we never have to poll for it. There are some edge cases, like the one I explained above, that can cause the auto deploy info to not be available. That's where this logic kicks in. We'll poll for auto-deploy information for a minute and then we'll gracefully exit if it never becomes available.
Screenshots
This is what will log to the user if the auto deploy information never becomes available

TODO
Who to Notify