Parcourir la source

Add a random delay to the measurement script

Baptiste Jonglez il y a 10 ans
Parent
commit
3cbf67b52e
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      templates/run.sh

+ 5 - 1
templates/run.sh

@@ -6,7 +6,10 @@
 UUID="{{ uuid|default('00000000-0000-0000-0000-000000000000') }}"
 PEERFINDER="{{ peerfinder }}"
 NB_PINGS=5
-SLEEP=6
+DELAY=10
+# This avoids synchronisation (everybody fetching jobs and running
+# measurements simultaneously)
+RANDOM_DELAY=20
 
 [ -z "$1" ] && FAMILY="ipv4" || FAMILY="ipv6"
 
@@ -14,6 +17,7 @@ SLEEP=6
 
 while :
 do
+    SLEEP=$((DELAY + RANDOM % RANDOM_DELAY))
     sleep "$SLEEP"
     curl "$PEERFINDER"/target/"$UUID"/"$FAMILY" > /tmp/"$FAMILY" 2> /dev/null
     read -r id ip < /tmp/"$FAMILY"