Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 17, 2023

This PR includes the following modifications to the service availability check...

  1. We only run the service availability check when deploying the service for the first time.
  2. We add a countdown to the output message (so users know how long is left before we timeout).
  3. We allow --status-check-code to be used as the 'expected status code' within the service availability check.

Screenshots

In the first screenshot, we can see the service availability check (eventually) received a non-500 status code, which signified the service was deployed to/available from the user's nearest Fastly POP...

Screenshot 2023-03-17 at 11 24 06

When running the fastly compute deploy command a second time after we already deployed the first time, we see there is no service availability check executed...

Screenshot 2023-03-17 at 11 24 14

In the following screenshot, we can see the service availability check 'in-flight' (i.e. running) and that it contains a timeout which helps users to see that the CLI has not stalled...

Screenshot 2023-03-17 at 11 23 28

In the following screenshot, we can see what happens when a timeout is reached. In the default case we're looking for a non-500 and so the WARNING message indicates this...

Screenshot 2023-03-17 at 11 22 33

Whereas the next screenshot demonstrates how the WARNING message changes when the user sets the --status-check-code flag, which tells the CLI the user expects a specific status code from the endpoint being checked...

Screenshot 2023-03-17 at 11 22 40

Finally, the following screenshot demonstrates a contrived example where a user expects their application to return a 500 by setting --status-check-code and thus the service availability check finishes almost immediately (but this doesn't mean the service is available and has returned an explicit 500, it's more likely in this scenario that the app hasn't reached the user's nearest POP and so the lookup has failed with a "No service available")...

Screenshot 2023-03-17 at 11 28 44

@Integralist Integralist added the enhancement New feature or request label Mar 17, 2023
@JakeChampion JakeChampion self-requested a review March 17, 2023 11:58
Copy link
Contributor

@JakeChampion JakeChampion left a comment

Choose a reason for hiding this comment

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

LGTM! I like that this now only happens on service creation and not each deploy ☺️

@Integralist Integralist merged commit ff3f438 into main Mar 17, 2023
@Integralist Integralist deleted the integralist/service-check branch March 17, 2023 12:03
@bstewart00
Copy link

bstewart00 commented Mar 21, 2023

Question: I'm creating Fastly services in my application and found myself needing to do a similar status check. I was surprised to see that the service initially responds with 500 responses with a plain body "Internal Server Error" until (presumably) it gets things initialized. Is there a reason Fastly doesn't use 503 Service Unavailable or something that would be more easy to distinguish from other kinds of 500 e.g. from the origin?
I have to do some hoops like "If it is a 500 and created in the last 2 minutes, Fastly is probably still initializing".

@Integralist
Copy link
Collaborator Author

Hi @bstewart00

Great question, I'm not sure why a 503 wasn't used. I'll enquire internally and see if I can find out the situation, because (agreed) the use of a 500 is not ideal.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants