Skip to content

Commit 3106ade

Browse files
authored
wormhole_attester client: Change "not enough data" HTTP code to 503 (#643)
Previously, we used 307 Internal Redirect to tell k8s that we're still waiting for the healthcheck window to fill up. Unfortunately, k8s assumes 3XX as a success, which wrongly tells it that the service is ready. Changing to 503 causes the expected probe failure to appear when the healthcheck state is not yet determined.
1 parent 0f3975f commit 3106ade

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

wormhole_attester/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wormhole_attester/client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-wormhole-attester-client"
3-
version = "4.0.0"
3+
version = "4.1.0"
44
edition = "2018"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

wormhole_attester/client/src/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ async fn healthcheck_handler() -> Result<impl Reply, Rejection> {
142142
);
143143
Ok(reply::with_status(msg, StatusCode::OK))
144144
}
145-
// Unhealthy - 503 Service Unavailable
145+
// Unhealthy - 500 Internal Server Error
146146
Some(false) => {
147147
let msg = format!(
148148
"unhealthy, all of {} latest attestations returned error",
149149
hc_state.max_window_size
150150
);
151-
Ok(reply::with_status(msg, StatusCode::SERVICE_UNAVAILABLE))
151+
Ok(reply::with_status(msg, StatusCode::INTERNAL_SERVER_ERROR))
152152
}
153-
// No data - 307 Temporary Redirect
153+
// No data - 503 Service Unavailable
154154
None => {
155155
let msg = if hc_state.enable {
156156
format!(
@@ -161,7 +161,7 @@ async fn healthcheck_handler() -> Result<impl Reply, Rejection> {
161161
} else {
162162
"Healthcheck disabled (enable_healthcheck is false)".to_string()
163163
};
164-
Ok(reply::with_status(msg, StatusCode::TEMPORARY_REDIRECT))
164+
Ok(reply::with_status(msg, StatusCode::SERVICE_UNAVAILABLE))
165165
}
166166
}
167167
}

0 commit comments

Comments
 (0)