Skip to content

Commit e221708

Browse files
authored
relax readiness check for HTTP (#106)
Pass readiness check if the web app gives an HTTP response (any status code)
1 parent bac616a commit e221708

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ When a new Lambda Execution Environment starts up, Lambda Web Adapter will boot
5959

6060
By default, Lambda Web Adapter will send HTTP GET requests to the web application at `http://127.0.0.1:8080/`. The port and path can be customized with two environment variables: `READINESS_CHECK_PORT` and `READINESS_CHECK_PATH`.
6161

62-
Lambda Web Adapter will retry this request every 10 milliseconds until the web application returns a successful response (http status code 2xx) or the function times out.
62+
Lambda Web Adapter will retry this request every 10 milliseconds until the web application returns an HTTP response (any status code) or the function times out.
6363

6464
In addition, you can configure the adapter to preform readiness check with TCP connect, by setting `READINESS_CHECK_PROTOCOL` to `tcp`.
6565

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ async fn is_web_ready(url: &Url, protocol: &Protocol) -> bool {
267267
async fn check_web_readiness(url: &Url, protocol: &Protocol) -> Result<(), i8> {
268268
match protocol {
269269
Protocol::Http => match reqwest::get(url.as_str()).await {
270-
Ok(response) if { response.status().is_success() } => Ok(()),
271-
_ => Err(-1),
270+
Ok(_) => Ok(()),
271+
Err(_) => Err(-1),
272272
},
273273
Protocol::Tcp => match TcpStream::connect(format!("{}:{}", url.host().unwrap(), url.port().unwrap())).await {
274274
Ok(_) => Ok(()),

0 commit comments

Comments
 (0)