Replace Emby dirty-sync workaround with play_state_sync in handback
Emby now runs continuously on both hosts — play_state_sync via API handles watch state reconciliation, making the 30-min dirty rsync redundant. Handback runs play_state_sync --wait before DNS cutover so users land on current state after a failover event. - Emby removed from FALLBACK_HOST1_TIER1 (always running) - Emby dirty sync removed from HOST1_CRITICAL_SYNC_SHARES - Emby writeback removed from FALLBACK_HOST1_WRITEBACK_TIER1 - play_state_sync gains --wait flag (uses lock wait mode for handback) - Tier 1 emby-fallback special case removed from handback writeback loop - play_state_sync --wait added as Step 7 in handback, before DNS cutover
This commit is contained in:
+16
-7
@@ -772,11 +772,7 @@ run_handback() {
|
|||||||
[[ -z "$job" ]] && continue
|
[[ -z "$job" ]] && continue
|
||||||
log "Syncing: $job"
|
log "Syncing: $job"
|
||||||
if [[ "$DRY_RUN" == false ]]; then
|
if [[ "$DRY_RUN" == false ]]; then
|
||||||
if [[ "$(basename "$job")" == "Emby" ]]; then
|
bash "$SCRIPT_DIR/../Rsync/rsync.sh" "$job"
|
||||||
bash "$SCRIPT_DIR/../Rsync/rsync.sh" "$job" --profile=emby-fallback
|
|
||||||
else
|
|
||||||
bash "$SCRIPT_DIR/../Rsync/rsync.sh" "$job"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
warn "DRY RUN — would rsync: $job"
|
warn "DRY RUN — would rsync: $job"
|
||||||
fi
|
fi
|
||||||
@@ -797,7 +793,20 @@ run_handback() {
|
|||||||
[[ "$is_ddns" == false ]] && remote_start "$container"
|
[[ "$is_ddns" == false ]] && remote_start "$container"
|
||||||
done
|
done
|
||||||
|
|
||||||
# ── Step 7: DNS Cutover — final step ────────────────────────────────────────────────────
|
# ── Step 7: Play State Sync — before DNS cutover so users land on current state ──────────
|
||||||
|
echo ""
|
||||||
|
echo "━━━ $ICON_SYNC Play State Sync ━━━"
|
||||||
|
if [[ "$DRY_RUN" == false ]]; then
|
||||||
|
if bash "$SCRIPT_DIR/../Media/play_state_sync.sh" --wait; then
|
||||||
|
log "Play state synced — $REMOTE_SERVER_NAME watch state reconciled ✅"
|
||||||
|
else
|
||||||
|
warn "play_state_sync failed — users may see stale watch state until next sync cycle"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "DRY RUN — would run play_state_sync --wait"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Step 8: DNS Cutover — final step ────────────────────────────────────────────────────
|
||||||
# DNS cuts over ONLY after Tier 1 containers confirmed up
|
# DNS cuts over ONLY after Tier 1 containers confirmed up
|
||||||
echo ""
|
echo ""
|
||||||
echo "━━━ $ICON_NET DNS Cutover ━━━"
|
echo "━━━ $ICON_NET DNS Cutover ━━━"
|
||||||
@@ -807,7 +816,7 @@ run_handback() {
|
|||||||
done
|
done
|
||||||
warn "$ICON_NET Remote DDNS started — DNS now points at $REMOTE_SERVER_NAME"
|
warn "$ICON_NET Remote DDNS started — DNS now points at $REMOTE_SERVER_NAME"
|
||||||
|
|
||||||
# ── Step 8: Return to NORMAL ─────────────────────────────────────────────────────────────
|
# ── Step 9: Return to NORMAL ─────────────────────────────────────────────────────────────
|
||||||
echo ""
|
echo ""
|
||||||
state_set state "NORMAL"
|
state_set state "NORMAL"
|
||||||
state_set fallback_start "0"
|
state_set fallback_start "0"
|
||||||
|
|||||||
@@ -73,11 +73,18 @@
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "$SCRIPT_DIR/../load_config.sh"
|
source "$SCRIPT_DIR/../load_config.sh"
|
||||||
|
|
||||||
# ── Handle --full before parse_args ───────────────────────────────────────────
|
# ── Handle --full and --wait before parse_args ────────────────────────────────
|
||||||
FULL_SYNC=false
|
FULL_SYNC=false
|
||||||
|
LOCK_MODE="strict"
|
||||||
_FILTERED=()
|
_FILTERED=()
|
||||||
for _a in "$@"; do
|
for _a in "$@"; do
|
||||||
[[ "$_a" == "--full" ]] && FULL_SYNC=true || _FILTERED+=("$_a")
|
if [[ "$_a" == "--full" ]]; then
|
||||||
|
FULL_SYNC=true
|
||||||
|
elif [[ "$_a" == "--wait" ]]; then
|
||||||
|
LOCK_MODE="wait"
|
||||||
|
else
|
||||||
|
_FILTERED+=("$_a")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
parse_args "${_FILTERED[@]}"
|
parse_args "${_FILTERED[@]}"
|
||||||
|
|
||||||
@@ -93,7 +100,7 @@ log "$ICON_GEAR Config: days=${SYNC_DAYS} types=${SYNC_TYPES} remote=${PLAY_SYNC
|
|||||||
|
|
||||||
command -v jq >/dev/null 2>&1 || { error "jq is required but not installed"; exit 1; }
|
command -v jq >/dev/null 2>&1 || { error "jq is required but not installed"; exit 1; }
|
||||||
|
|
||||||
acquire_lock
|
acquire_lock "$LOCK_MODE"
|
||||||
|
|
||||||
# ── Build server list across ALL hosts ────────────────────────────────────────
|
# ── Build server list across ALL hosts ────────────────────────────────────────
|
||||||
# All HOST*_TRANSCODE_SERVERS arrays are loaded into env by load_config.sh.
|
# All HOST*_TRANSCODE_SERVERS arrays are loaded into env by load_config.sh.
|
||||||
|
|||||||
Reference in New Issue
Block a user