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

Serve from cache when response.code != 200 #21

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

idl0r
Copy link
Contributor

@idl0r idl0r commented May 20, 2022

When you have a loadbalancer in between Puppet and Foreman for example
and it'll serve a 503 when the backend(s) (actual Foreman) are down, it
wouldn't serve from the cache without catching the
Net::HTTPServiceUnavailable exception

For that to work we had to implement a new Exception,
ForemanUnavailableError, since Net::HTTPServiceUnavailable is not an
actual exception.

@idl0r
Copy link
Contributor Author

idl0r commented May 20, 2022

I'll refactor it even more, to serve from cache for other errors as well.

Example:
You have a loadbalancer in between Puppet and Foreman and it'll serve a 503
when the backend(s) (actual Foreman) are down, it wouldn't serve from the
cache without this new NodeRetrievalError exception

So raising the exception, still logging a useful message but serving
from cache makes the most sense here
@idl0r
Copy link
Contributor Author

idl0r commented May 20, 2022

Ok, done. Feel free to review now :)

@idl0r idl0r changed the title Serve from cache when Net::HTTPServiceUnavailable Serve from cache when response.code != 200 May 20, 2022
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Thanks!

@ekohl ekohl added the Enhancement New feature or request label Oct 27, 2022
@ekohl ekohl merged commit a5d2ce1 into theforeman:master Oct 27, 2022
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.

2 participants