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

Allow setting server-wide status via StaticChecker #75

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

jhump
Copy link
Member

@jhump jhump commented Jan 22, 2025

Previously, the StaticChecker would allow calling code to change the status for a service named "", but it was effectively discarded (it was actually stored in a map, but never queried). The handling of requests for the empty-named service (which returns a "server-wide" status instead of a service-specific status) never bothered to look at the checker's map.

This change updates the tests to demonstrate the issue and then fixes it by having the handler first look at the map to see if a server-wide status is set. It then defaults to Serving only if nothing is found in the map.

This is not particularly ergonomic (since it feels like the server-wide status should somehow be derived from and/or impact the per-service statuses), but the intent is not to make StaticChecker more sophisticated but just to remove what appears to be a bug. It could be argued that it's not a bug and that a documentation update might suffice, but the current behavior is counter-intuitive, so it seemed best to change it.

@jhump jhump force-pushed the jh/allow-setting-server-wide-status branch from 79b3f3f to 0e7d326 Compare January 22, 2025 17:19
Copy link
Member

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Whoops! Good catch.

… no service name is specified in check request)

Signed-off-by: Josh Humphries <[email protected]>
@jhump jhump force-pushed the jh/allow-setting-server-wide-status branch from 0e7d326 to b7dd413 Compare January 22, 2025 18:01
@jhump jhump merged commit 83ff7f6 into main Jan 23, 2025
5 checks passed
@jhump jhump deleted the jh/allow-setting-server-wide-status branch January 23, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants