Bound the site-readiness poll in ship and survive connection failures - #216
Merged
Conversation
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
After a successful deploy, cloud ship asks whether to open the site and then polls the environment URL in
Ship::waitForUrlToBeReady():This has three problems:
Http::get()throwsConnectionExceptionon a DNS failure or refused connection. Nothing catches it, so the user gets a stack trace immediately after a deploy that actually succeeded.This is the same class of bug as #193 (a validation loop with no exit), on the HTTP side.
Change
waitForUrlToBeReady()now uses Laravel'sretry()helper with an attempt budget:$maxAttemptstimes (default 60, i.e. ~2 minutes at the existing 2-second interval), then returns false so the caller falls through to the existing "It looks like there is an error in your deployed site" path, which already offers to open the logs.RequestExceptionviathrowIf($response->clientError())and retried; aConnectionExceptionis retried the same way. Both mean "not ready yet."Http::timeout(10)per request.The signature is backward-compatible (
$maxAttemptshas a default) and the only call site is thespin()inShip::handle(), so no caller changes.