Skip to content

Commit

Permalink
mimic busy sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Phani Sajja <[email protected]>
  • Loading branch information
sajjaphani committed Dec 12, 2024
1 parent 1b0c548 commit bb2e582
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/studio/bin/hab-studio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,16 @@ chown_certs() {
fi
}

# **Internal**
# Mimic delay using busy loop
busy_sleep() {
local duration=$1
local end_time=$(( $(date +%s) + duration ))
while [ "$(date +%s)" -lt "$end_time" ]; do
: # No-op, keeps the loop running
done
}

# **Internal** Unmount mount point if mounted and abort if an unmount is
# unsuccessful.
#
Expand Down Expand Up @@ -1072,7 +1082,7 @@ umount_fs() {
i=1
while [ "$i" -le "$MAX_RETRIES" ]
do
hab pkg exec core/coreutils sleep $((RETRY_DELAY * i)) # Delay increases with each retry
busy_sleep $((RETRY_DELAY * i)) # Delay increases with each retry
if ! is_fs_mounted "$_mount_point"; then
return 0
fi
Expand Down

0 comments on commit bb2e582

Please sign in to comment.