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

Up/Down Badge works when site is up - not when down #9844

Closed
imagelessthought opened this issue Dec 26, 2023 · 8 comments · Fixed by #9966
Closed

Up/Down Badge works when site is up - not when down #9844

imagelessthought opened this issue Dec 26, 2023 · 8 comments · Fixed by #9966
Labels
bug Bugs in badges and the frontend service-badge New or updated service badge

Comments

@imagelessthought
Copy link

Are you experiencing an issue with...

shields.io

🐞 Description

Trying to use the website/up down badge. It works fine when the website is up:

guacamole.unt.edu

But if the server is shutdown: after the timeout it does not show the website down image.

main.guacamole.unt.edu

If I put in fake info - the down image does load correctly.

Website fakesite.invalid

Any suggestions? Thanks. I did try and find a reeference somewhere to the issue, I am sure it is something rather simple - just cannot determien what it is.

🔗 Link to the badge

https://imagelessthought.github.io/mainroad/status/

This page has some that I threw on there for testing. It is the secnd one that shows the failure:

main.guacamole.unt.edu

💡 Possible Solution

No response

@imagelessthought imagelessthought added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Dec 26, 2023
@chris48s
Copy link
Member

chris48s commented Dec 28, 2023

OK, so it looks like if the website instantly responds with an invalid code (e.g: 500) or we get a connection error or whatever, we'll show the down image. If the upstream website fails in a way that just holds the connection open, we'll also just hang waiting.

I think we need to add a timeout to https://github.com/badges/shields/blob/master/services/website/website.service.js (and update the docs).

I'm inclined to make the timeout something like 3.5 seconds to try and keep the whole badge request/response inside the 4 second camo limit.

@chris48s chris48s added bug Bugs in badges and the frontend service-badge New or updated service badge and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Dec 28, 2023
@imagelessthought
Copy link
Author

imagelessthought commented Dec 28, 2023

@chris48s Thanks. I will try and setup a local instance and play around with it. Much appreciated.

@erayerdin
Copy link
Contributor

@chris48s Would you like me to take out this one?

@chris48s
Copy link
Member

Yes - feel free. This should hopefully be a one line change 🤞 I just lost sight of it because someone else said they would submit the PR

@imagelessthought
Copy link
Author

Sorry, I should have followed up but I assumed someone got to it before me as it stopped generating a an error.

In the description I posted, the button after,
"But if the server is shutdown: after the timeout it does not show the website down image",
was generating an error when I posted it. It was reporting an error when @chris48s responded as well.

But when I went back to check on it and take a shot at resolving the issue, it was no longer generating the error.

@erayerdin
Copy link
Contributor

When I took a look at the code (website.service.js), I was suddenly enlightened thinking "If a server is shut down, it should not respond at all, why would it keep the connection open?". Your comment makes kinda sense.

But again, in any case server takes a significant amount of time responding, I could still implement some kind of a timeout for it. So, I leave the final decision to @chris48s.

@chris48s, should I go on?

@chris48s
Copy link
Member

I think it still makes sense to put a timeout on this 👍

@erayerdin
Copy link
Contributor

I think it still makes sense to put a timeout on this 👍

After completing #9954, will go back to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in badges and the frontend service-badge New or updated service badge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants