From 0efc295863760656fc5be2d6fd5eb1a72d22b2ab Mon Sep 17 00:00:00 2001 From: 0xFugue <119708655+0xFugue@users.noreply.github.com> Date: Fri, 20 Jan 2023 20:21:02 +0530 Subject: [PATCH] the subscriber will wait longer to maximise the reception --- run-waku.sh | 29 +++++++++++++++-------------- waku/common/commons.go | 2 ++ waku/config.json | 4 ++-- waku/filter/filter.go | 7 ++++++- waku/lightpush/lightpush.go | 2 +- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/run-waku.sh b/run-waku.sh index acfca34..77c6aaf 100755 --- a/run-waku.sh +++ b/run-waku.sh @@ -24,7 +24,7 @@ loglvl="info" # log level duration=$2 #iat=$3 -sleep_time=30 +sleep_time=20 time="" unique="XYZ" @@ -119,18 +119,6 @@ docker_run() { #darg= "--network=host" - - [ -d $LPDIR ] || mkdir -p $LPDIR - ofname="$LPDIR/$lpush.out" - echo "docker: stopping and removing $prefix-$lpush" - docker stop $prefix-$lpush - docker rm $prefix-$lpush - echo "docker: starting $prefix-$lpush" - echo " docker run --name "$prefix-$lpush" -d=true "$prefix-$lpush:alpha" -o "$docker_op_dir/$lpush.out" -d $duration -i $iat -l $loglvl -c $ctopic" - docker run --name "$prefix-$lpush" -d=true "$prefix-$lpush:alpha" -o "$docker_op_dir/$lpush.out" -d $duration -i $iat -l $loglvl -c $ctopic - - #sleep $sleep_time - [ -d $FTDIR ] || mkdir -p $FTDIR ofname="$FTDIR/$filtr.out" echo "docker: stopping and removing $prefix-$filtr" @@ -141,6 +129,17 @@ docker_run() { docker run --name "$prefix-$filtr" -d=true "$prefix-$filtr:alpha" -o "$docker_op_dir/$filtr.out" -d $duration -l $loglvl -i $iat -c $ctopic echo "$prefix-$filtr is running as $prefix-$filtr" + sleep $sleep_time + + [ -d $LPDIR ] || mkdir -p $LPDIR + ofname="$LPDIR/$lpush.out" + echo "docker: stopping and removing $prefix-$lpush" + docker stop $prefix-$lpush + docker rm $prefix-$lpush + echo "docker: starting $prefix-$lpush" + echo " docker run --name "$prefix-$lpush" -d=true "$prefix-$lpush:alpha" -o "$docker_op_dir/$lpush.out" -d $duration -i $iat -l $loglvl -c $ctopic" + docker run --name "$prefix-$lpush" -d=true "$prefix-$lpush:alpha" -o "$docker_op_dir/$lpush.out" -d $duration -i $iat -l $loglvl -c $ctopic + # now wait for runs to complete... echo "$(date): Waiting for the docker run to finish in $duration" @@ -183,7 +182,9 @@ kurtosis_run() { }" > waku/config.json kurtosis run --enclave-id $enclave . '{"config":"github.com/logos-co/wadoku/waku/config.json"}' > $FTDIR/kurtosis_output.log - sleep $sleep_time + + sleep $sleep_time + filtr_suffix="$(kurtosis enclave inspect $enclave | grep $prefix-$filtr | cut -f 1 -d ' ')" lpush_suffix="$(kurtosis enclave inspect $enclave | grep $prefix-$lpush | cut -f 1 -d ' ')" diff --git a/waku/common/commons.go b/waku/common/commons.go index 0fa5f76..2d27dc3 100644 --- a/waku/common/commons.go +++ b/waku/common/commons.go @@ -9,6 +9,8 @@ import ( const StartPort = 60000 const PortRange = 1000 +const GraceWait = 10 // percentage +const InterPubSubDelay = 25 // seconds const DnsDiscoveryUrl = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im" const NameServer = "1.1.1.1" const LocalHost = "0.0.0.0" diff --git a/waku/config.json b/waku/config.json index afa5c64..70ea197 100644 --- a/waku/config.json +++ b/waku/config.json @@ -1,8 +1,8 @@ { "output_file": "output.out", - "duration": "2000s", + "duration": "1024s", "iat": "100ms", - "content_topic": "2000s-100ms-2023-01-18-14h33m38s-XYZ", + "content_topic": "1024s-100ms-2023-01-20-16h01m32s-XYZ", "log_level": "info", "log_file": "output.log" } diff --git a/waku/filter/filter.go b/waku/filter/filter.go index c35ff4a..87354e0 100644 --- a/waku/filter/filter.go +++ b/waku/filter/filter.go @@ -145,8 +145,13 @@ func main() { log.Error("Out of the Write loop: Message channel closed - timeout") stopC <- struct{}{} }() + // add extra 20sec + 5% as a grace period to receive as much as possible + filterWait := conf.Duration + + common.InterPubSubDelay * time.Second + + conf.Duration/100*common.GraceWait - <-time.After(conf.Duration) + log.Info("Will be waiting for ", filterWait, ", excess ", common.GraceWait, "% from ", conf.Duration) + <-time.After(filterWait) log.Error(conf.Duration, " elapsed, closing the " + nodeType + " node!"); // shut the nodes down diff --git a/waku/lightpush/lightpush.go b/waku/lightpush/lightpush.go index 76ac818..de26bee 100644 --- a/waku/lightpush/lightpush.go +++ b/waku/lightpush/lightpush.go @@ -63,7 +63,7 @@ func main() { node.WithHostAddress(hostAddr), //node.WithNTP(), // don't use NTP, fails at msec granularity node.WithWakuRelay(), - node.WithLightPush(), + //node.WithLightPush(), // no need to add lightpush to be a lightpush client! ) if err != nil { panic(err)