Browse Source

Add a random delay to the measurement script

Baptiste Jonglez 10 years ago
parent
commit
3cbf67b52e
1 changed files with 5 additions and 1 deletions
  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"