Skip to content

Commit

Permalink
calling cci APIs can take time so don't use loop_time as increment (#23)
Browse files Browse the repository at this point in the history
use wall clock instead to calculate wait_time
  • Loading branch information
erchn authored Oct 30, 2024
1 parent 0dd26b4 commit 89a95bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/scripts/global-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,16 @@ load_variables
max_time=${CONFIG_TIME}
echo "This build will block until all previous builds complete."
echo "Max Queue Time: ${max_time} minutes."
wait_time=0
wait_start_time=$(date +%s)
loop_time=11
max_time_seconds=$((max_time * 60))

# queue loop
confidence=0
while true; do
update_comparables
now=$(date +%s)
wait_time=$((now - wait_start_time))
echo "This Workflow Timestamp: ${my_commit_time}"
echo "Oldest Workflow Timestamp: ${oldest_commit_time}"
if [[ -n "${my_commit_time}" ]] && [[ "${oldest_commit_time}" > "${my_commit_time}" || "${oldest_commit_time}" = "${my_commit_time}" ]] ; then
Expand Down Expand Up @@ -173,5 +175,4 @@ while true; do
fi

sleep $loop_time
wait_time=$(( loop_time + wait_time ))
done
5 changes: 3 additions & 2 deletions src/scripts/pipeline-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ update_comparables(){

load_variables
echo "This build will block until all previous builds complete."
wait_time=0
wait_start_time=$(date +%s)
loop_time=11

# queue loop
confidence=0
while true; do
update_comparables
now=$(date +%s)
wait_time=$(( now - wait_start_time ))

# if we have no running workflows, check confidence, and move to front of line.
if [[ "${running_workflows}" -eq 0 ]] ; then
Expand All @@ -90,5 +92,4 @@ while true; do
fi

sleep $loop_time
wait_time=$(( loop_time + wait_time ))
done

0 comments on commit 89a95bb

Please sign in to comment.