Recover local Sendico session after BFF network restarts (#57)
This commit is contained in:
1 parent
021bd04324
commit
13cc9c302e
9 files changed
+158
-8
No files matched your search
@@ -0,0 +1,20 @@
|
||||
# Restarting the network-owning BFF can strand this sidecar in its old namespace.
|
||||
# Exiting the session process lets Docker rejoin the BFF's current namespace.
|
||||
watch_network() {
|
||||
network_parent=$1
|
||||
case "$network_parent" in ''|*[!0-9]*) return 1;; esac
|
||||
[ "$network_parent" -gt 0 ] || return 1
|
||||
network_failures=0
|
||||
while sleep 10; do
|
||||
if timeout 5 getent hosts vault >/dev/null 2>&1; then
|
||||
network_failures=0
|
||||
continue
|
||||
fi
|
||||
network_failures=$((network_failures+1))
|
||||
if [ "$network_failures" -ge 3 ]; then
|
||||
echo 'Local Sendico network DNS unavailable; restarting session container to reattach BFF network.' >&2
|
||||
kill -TERM "$network_parent" 2>/dev/null || true
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
Reference in new issue
Block a user