perf: replace /dev/urandom | tr with openssl rand to fix CPU spike (#3887)

This commit is contained in:
Yunheng Liu authored and GitHub committed 2026-04-01 13:59:48 +02:00
1 parent 7e6d80efa5
commit 169b216d7e
3 files changed
+25 -22

No files matched your search

+3 -2
View File
@@ -243,8 +243,9 @@ reset_user() {
gen_random_string() {
local length="$1"
local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$length" | head -n 1)
echo "$random_string"
openssl rand -base64 $(( length * 2 )) \
| tr -dc 'a-zA-Z0-9' \
| head -c "$length"
}
reset_webbasepath() {