Skip to content

Commit

Permalink
Temp fix for ImAlive to fall back to MG22 when MG21 is not returning …
Browse files Browse the repository at this point in the history
…"ok"

This update provides a temporary work-around for MG21 unduly returning "ko" for active feeders. This "ko" message is because the MongoDB database on MG21, which maintains the feeder status, isn't correctly updated. 
Temp solution is for every "ko" to then also poll MG22, which generally will provide the correct status. 

This results in a double poll of MG21 and MG22 in case MG21 returns "ko", which is acceptable for now because these polls happen only in 10 minute intervals for active stations.

Once the MongoDB issue is fixed on MG21, this code becomes harmless because the extra poll will only be done if a feeder is actually "bad". This would be only a very small subsets of all stations feeding to MG21. In any case, we advise to revert this change once the ImAlive function on MG21 is fixed and stable.
  • Loading branch information
kx1t authored Aug 7, 2024
1 parent 5382406 commit 566a0c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rootfs/etc/s6-overlay/scripts/imalive
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ do
st=${FEEDER_KEY%%:*}
timestamp=$(date "+%s")
#echo " $st Current Time : $ts"
if ! STATUS="$(curl -sSL "${RV_SERVER%%:*}"/rtools/pyalive.php?stid="${st,,}" 2>&1)"; then
#
# 07-AUG-2024 -- added the following code because at the moment, MG21 is providing a "ko" unduely due to server side MongoDB issues
# once fixed, we can revert to the original line
# ORIGINAL:
# if ! STATUS="$(curl -sSL "${RV_SERVER%%:*}"/rtools/pyalive.php?stid="${st,,}" 2>&1)"; then
# NEW: (revert this 1 line once MG21 is fixed)
if ! STATUS="$(curl -sSL "${RV_SERVER%%:*}"/rtools/pyalive.php?stid="${st,,}" 2>&1)" || [[ "${STATUS%%-*}" == "ko" ]]; then
if STATUS="$(curl -sSL http://mg22.adsbnetwork.com/rtools/pyalive.php?stid="${st,,}" 2>&1)"; then
"${s6wrap[@]}" echo "ImAlive status on ${RV_SERVER%%:*} wasn't available, fell back to mg22.adsbnetwork.com"
else
Expand Down

0 comments on commit 566a0c2

Please sign in to comment.