Skip to content

Commit 0683079

Browse files
committed
fix(deploy): use blocking flock to wait for previous build
Non-blocking flock wrote 'failed' to shared status file when a previous build was still running, causing the Action to report failure even though the build eventually succeeded. Now waits up to 300s for the lock.
1 parent 8ed5589 commit 0683079

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/deploy-droplet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ jobs:
120120
121121
echo ""
122122
echo "=== Cleaning build cache ==="
123-
# Acquire exclusive lock to prevent concurrent deploys on server
123+
# Acquire exclusive lock — wait for any previous deploy to finish
124124
exec 200>/tmp/deploy-build.lock
125-
flock -n 200 || { echo "✗ Another deploy is running"; echo "failed" > "$STATUS_FILE"; exit 1; }
125+
flock -w 300 200 || { echo "✗ Lock timeout after 300s"; echo "failed" > "$STATUS_FILE"; exit 1; }
126126
127127
# Kill any lingering next build processes
128128
pkill -f "next build" 2>/dev/null || true

0 commit comments

Comments
 (0)