From adb91c29e869379ba7021146d3f72162693d920b Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 14 Aug 2024 23:15:02 +0800 Subject: [PATCH] chore: Refactor _get_fastest function to improve readability and performance --- files/initrd/opt/rr/include/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 306efc19..3801932f 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -222,7 +222,7 @@ function _get_fastest() { URL="$(echo "${fastest}" | awk '{print $1}')" SPD="$(echo "${fastest}" | awk '{print $2}')" # It is a float type echo "${URL}" - [ $(printf "%.0f" ${SPD:-999}) -ge 999 ] && return 1 || return 0 + [ $(echo ${SPD:-999} | cut -d. -f1) -ge 999 ] && return 1 || return 0 } ###############################################################################