PM-trigger via Gitea: pm-task.sh + webhook routing on pm:plan label + idempotency
This commit is contained in:
@@ -19,11 +19,13 @@ ISSUE="${2:-}"
|
||||
[[ -z "$REPO" || -z "$ISSUE" ]] && { echo "usage: $0 <owner>/<repo> <issue-id>" >&2; exit 64; }
|
||||
|
||||
# Serialize: only one dev-task active at a time (Max-plan rate-limit pool).
|
||||
# Wait up to 60s for the lock; if still held, exit 75 so the webhook retries.
|
||||
# Wait up to LOCK_WAIT seconds (default 30 min — enough for one queued task
|
||||
# behind a max-wallclock task). If still held, exit 75.
|
||||
LOCK_FILE="${LOCK_FILE:-/var/agent/dev-task.lock}"
|
||||
LOCK_WAIT="${LOCK_WAIT:-1800}"
|
||||
exec 200>"$LOCK_FILE"
|
||||
if ! flock -w 60 200; then
|
||||
echo "[dev-task] another dev-task is running; backing off" >&2
|
||||
if ! flock -w "$LOCK_WAIT" 200; then
|
||||
echo "[dev-task] queue full after ${LOCK_WAIT}s wait; backing off" >&2
|
||||
exit 75
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user