openvidu-deployment: GCP - add lock mechanism to prevent more than one graceful shutdowns of OpenVidu Media Node

pull/884/merge
Piwccle 2026-06-04 12:30:33 +02:00
parent 09cf208f73
commit 82ae32b9fe
2 changed files with 20 additions and 0 deletions

View File

@ -1242,6 +1242,16 @@ EOF
#!/bin/bash -x
set -e
# Prevent concurrent/repeated runs. The check-abandoned cron fires every minute and would
# otherwise launch this script again while a drain is already in progress, sending a second
# SIGQUIT to the media node. LiveKit interprets the second signal as a forced shutdown
# (force=true), which closes rooms and kicks out participants instead of waiting for them.
exec 9>/var/lock/openvidu_shutdown.lock
if ! flock -n 9; then
echo "Graceful shutdown already in progress, skipping..."
exit 0
fi
echo "Starting graceful shutdown of OpenVidu Media Node..."
INSTANCE_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")

View File

@ -1609,6 +1609,16 @@ EOF
#!/bin/bash -x
set -e
# Prevent concurrent/repeated runs. The check-abandoned cron fires every minute and would
# otherwise launch this script again while a drain is already in progress, sending a second
# SIGQUIT to the media node. LiveKit interprets the second signal as a forced shutdown
# (force=true), which closes rooms and kicks out participants instead of waiting for them.
exec 9>/var/lock/openvidu_shutdown.lock
if ! flock -n 9; then
echo "Graceful shutdown already in progress, skipping..."
exit 0
fi
echo "Starting graceful shutdown of OpenVidu Media Node..."
INSTANCE_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")