Added random sleep time
This commit is contained in:
parent
cf02ca95ff
commit
fca39791af
1 changed files with 4 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
version="0.3.0"
|
||||
|
||||
|
||||
if [ -n "$PROXY_URL" ]; then
|
||||
proxy_url="$PROXY_URL"
|
||||
else
|
||||
|
@ -102,7 +103,7 @@ downloadTrack() {
|
|||
if [ "$success" = false ]; then
|
||||
echo "Attempt $attempt_num failed. Retrying..."
|
||||
((attempt_num++))
|
||||
sleep 1 # TODO: random sleep time
|
||||
sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -204,7 +205,7 @@ downloadAlbum() {
|
|||
else
|
||||
echo "Attempt $attempt_num failed. Retrying..."
|
||||
((attempt_num++))
|
||||
sleep 1
|
||||
sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -241,7 +242,7 @@ searchAlbum() {
|
|||
if [ "${#albums_list[@]}" -eq 0 ]; then
|
||||
echo "No albums found. Retrying... (Attempt $attempt_num/$max_attempts)"
|
||||
((attempt_num++))
|
||||
sleep 1
|
||||
sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
|
||||
else
|
||||
PS3="Please select an album: "
|
||||
select t in "${albums_list[@]}"; do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue