Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dev2/deploy-poll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ case "${1:-}" in
*) echo "usage: deploy-poll.sh [--dry-run|--status]" >&2; exit 2 ;;
esac

# One pass at a time; a slow ls-remote must not stack cron runs.
exec 9>"$STATE_DIR/.poll.lock"
flock -n 9 || exit 0
# One deploying pass at a time; a slow ls-remote must not stack cron runs.
# --status/--dry-run only read, so they skip the lock: a status loop holding it
# made every cron pass exit silently and nothing deployed for hours.
if [ "$mode" = run ]; then
exec 9>"$STATE_DIR/.poll.lock"
flock -n 9 || exit 0
fi

log() { printf '%s %s\n' "$(date -u +%FT%TZ)" "$*" >> "$STATE_DIR/poll.log"; }

Expand Down
Loading