aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-04-22 20:23:44 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-04-22 20:23:44 +1200
commit4554c8c3585e7fc5e7e5a7edd4103a0a20b34f4f (patch)
tree7edeb6d7cd6acbdf846bb8a9a9af2df0054a7d3f
parentSpeed up key pulls (diff)
downloadparcimini-4554c8c3585e7fc5e7e5a7edd4103a0a20b34f4f.tar.gz
parcimini-4554c8c3585e7fc5e7e5a7edd4103a0a20b34f4f.zip
Avoid a fork by shuffling list in place
-rw-r--r--parcimini.bash7
1 files changed, 3 insertions, 4 deletions
diff --git a/parcimini.bash b/parcimini.bash
index 54f2ceb..016f166 100644
--- a/parcimini.bash
+++ b/parcimini.bash
@@ -24,13 +24,12 @@ END { for (key_id in key_ids) print key_id }'
printf >&2 '%s: Started; base interval %u seconds.\n' \
"$self" "$interval"
-# While we're able to write the key list to the file, refresh all of them
-while key_ids > "$list" ; do
+# While we're able to write a shuffled key list to the file, refresh all of them
+while key_ids | shuf > "$list" ; do
printf >&2 '%s: Beginning new round; %u key IDs found.\n' \
"$self" "$(sed '$=;d' "$list")"
# Shuffle list and read each ID
- shuf "$list" |
while read -r key_id ; do
# Sleep for a random interval
@@ -44,5 +43,5 @@ while key_ids > "$list" ; do
"$self" "$key_id"
gpg --batch --no-tty --recv-key "$key_id"
- done
+ done < $list
done