Skip to content

Commit

Permalink
limit maximum download time to 720sec (results in min ~220kbit/s to d…
Browse files Browse the repository at this point in the history
…ownload a 20MB file) (Mitigate #267)
  • Loading branch information
hobbyquaker committed Jan 3, 2020
1 parent ae6daf1 commit 00a771f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addon_files/redmatic/bin/redmatic-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function install()
echo "Get $URL"
set -o pipefail
T_START=$(date +"%s")
/usr/bin/curl $URL -o $ADDON_DIR/tmp/$1.tar.gz --fail --show-error --silent --location 2>&1 || error "Install failed."
/usr/bin/curl $URL -o $ADDON_DIR/tmp/$1.tar.gz --fail --show-error --silent --max-time 720 --location 2>&1 || error "Download failed."
T_END=$(date +"%s")
echo "Downloaded $(stat -c %s $ADDON_DIR/tmp/$1.tar.gz | awk '{ suffix="KMGT"; for(i=0; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }')in $(( T_END-T_START )) seconds"

Expand Down

0 comments on commit 00a771f

Please sign in to comment.