Make PIA connection check more tollerant to hiccups
All checks were successful
Check Flake / check-flake (push) Successful in 15m39s
All checks were successful
Check Flake / check-flake (push) Successful in 15m39s
This commit is contained in:
@@ -270,10 +270,17 @@ in
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MAX_RETRIES=4
|
||||||
|
for attempt in $(seq 1 $MAX_RETRIES); do
|
||||||
if check_vpn; then
|
if check_vpn; then
|
||||||
rm -f "$COUNTER_FILE"
|
rm -f "$COUNTER_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
if [ "$attempt" -lt "$MAX_RETRIES" ]; then
|
||||||
|
echo "Attempt $attempt/$MAX_RETRIES failed, retrying in 5 minutes..." >&2
|
||||||
|
sleep 300
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Failed — read and update counter (reset if from a previous day)
|
# Failed — read and update counter (reset if from a previous day)
|
||||||
today=$(date +%Y-%m-%d)
|
today=$(date +%Y-%m-%d)
|
||||||
@@ -302,7 +309,7 @@ in
|
|||||||
description = "Periodic PIA VPN connectivity check";
|
description = "Periodic PIA VPN connectivity check";
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "*:0/5";
|
OnCalendar = "*:0/30";
|
||||||
RandomizedDelaySec = "30s";
|
RandomizedDelaySec = "30s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user