Skip to content

Commit

Permalink
try_to_dequeue_head
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemfh authored Oct 25, 2024
1 parent 5b9f14c commit 5ff6515
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions rootfs/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ wait_for_lock() {
__exit_code=$? # timeout returns 143

if [ $__exit_code -eq 143 ]; then
dequeue_head $1 $2 $3
try_to_dequeue_head $1 $2 $3
fi
done
}
Expand Down Expand Up @@ -162,15 +162,11 @@ dequeue() {
# $1: branch
# $2: queue_file
# $3: ticket_id
dequeue_head() {
try_to_dequeue_head() {
__branch=$1
__queue_file=$2
__ticket_id=$3

__has_error=0

update_branch $__branch

# Remove head
cur_lock=$(head -n 1 $__queue_file)
echo "[$__ticket_id] Waiting for lock - Force unlocking [$cur_lock]"
Expand All @@ -180,13 +176,5 @@ dequeue_head() {
git add $__queue_file
git commit -m "$__message" --quiet

set +e # allow errors
git push --set-upstream origin $__branch --quiet
__has_error=$((__has_error + $?))
set -e

if [ ! $__has_error -eq 0 ]; then
sleep 1
dequeue_head $@
fi
git push --set-upstream origin $__branch --quiet || true
}

0 comments on commit 5ff6515

Please sign in to comment.