From 2d738c4e0f3324a144bc8b7f1710f2697fd37f17 Mon Sep 17 00:00:00 2001 From: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com> Date: Sat, 6 Jan 2024 06:42:14 +0800 Subject: [PATCH] docker: set HEALTHCHECK timeouts to 1s (#3677) Signed-off-by: Adrian Cole --- build-bin/docker/docker-healthcheck | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build-bin/docker/docker-healthcheck b/build-bin/docker/docker-healthcheck index 0556905e3a4..c5233b3f6d2 100755 --- a/build-bin/docker/docker-healthcheck +++ b/build-bin/docker/docker-healthcheck @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2015-2020 The OpenZipkin Authors +# Copyright 2015-2024 The OpenZipkin Authors # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -45,11 +45,13 @@ case ${kind} in path=${HEALTHCHECK_PATH:-/health} endpoint="http://${ip}:${port}${path}" # Use b3:0 to ensure health checks aren't traced - out=$(wget -qO- "${endpoint}" --header=b3:0 2>&1) + # Use timeout 1s (-T 1) as the health check interval is often 1s + out=$(wget -T 1 -qO- "${endpoint}" --header=b3:0 2>&1) rc=$? ;; tcp ) - out=$(nc -z ${ip} ${port} 2>&1) + # Use timeout 1s (-w 1) as the health check interval is often 1s + out=$(nc -w 1 -z ${ip} ${port} 2>&1) rc=$? ;; * )