@keepur/hive 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/service/deploy.sh +20 -4
package/package.json
CHANGED
package/service/deploy.sh
CHANGED
|
@@ -11,6 +11,15 @@ BUILD_DIR="${BUILD_DIR:-$HOME/build/hive}"
|
|
|
11
11
|
DEPLOY_DIR="${DEPLOY_DIR:-$HOME/services/hive}"
|
|
12
12
|
INSTANCES_CONF="${HIVE_INSTANCES_CONF:-$SCRIPT_DIR/instances.conf}"
|
|
13
13
|
|
|
14
|
+
# Health check tunables (KPR-185). Cold-start can transiently exceed a single
|
|
15
|
+
# 30s window — DNS, Slack handshake, MongoDB warmup occasionally tip past the
|
|
16
|
+
# original budget on otherwise-healthy boots. Three retries × 30s with 10s
|
|
17
|
+
# waits between covers that without changing happy-path latency: a healthy
|
|
18
|
+
# engine still resolves on the first attempt, typically well under 30s.
|
|
19
|
+
HEALTH_CHECK_RETRIES=3
|
|
20
|
+
HEALTH_CHECK_WINDOW=30
|
|
21
|
+
HEALTH_CHECK_WAIT_BETWEEN=10
|
|
22
|
+
|
|
14
23
|
# Single-instance mode (KPR-70): when invoked by `hive update` for a customer
|
|
15
24
|
# install, the calling instance passes its own facts via env, and we skip the
|
|
16
25
|
# build-from-source phase + the shipped instances.conf entirely. The instance
|
|
@@ -124,11 +133,18 @@ health_check() {
|
|
|
124
133
|
echo "[DRY RUN] health_check: would check $log_file"
|
|
125
134
|
return 0
|
|
126
135
|
fi
|
|
127
|
-
for
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
for attempt in $(seq 1 "$HEALTH_CHECK_RETRIES"); do
|
|
137
|
+
if [[ "$attempt" -gt 1 ]]; then
|
|
138
|
+
echo " Health check attempt $attempt/$HEALTH_CHECK_RETRIES (waiting ${HEALTH_CHECK_WAIT_BETWEEN}s before retry)..."
|
|
139
|
+
sleep "$HEALTH_CHECK_WAIT_BETWEEN"
|
|
131
140
|
fi
|
|
141
|
+
for _ in $(seq 1 "$HEALTH_CHECK_WINDOW"); do
|
|
142
|
+
sleep 1
|
|
143
|
+
if tail -5 "$log_file" 2>/dev/null | grep -q '"Hive is running"'; then
|
|
144
|
+
return 0
|
|
145
|
+
fi
|
|
146
|
+
done
|
|
147
|
+
echo " Health check attempt $attempt/$HEALTH_CHECK_RETRIES failed (no 'Hive is running' in last ${HEALTH_CHECK_WINDOW}s)."
|
|
132
148
|
done
|
|
133
149
|
return 1
|
|
134
150
|
}
|