| | |
| | | MONITORING_PERIOD=60 |
| | | |
| | | # Three converged samples in a row, the last one started more than a monitoring period (and |
| | | # the publisher's 5 s latch) after the first ended. Sets CONVERGED_IN to the seconds until the |
| | | # first of them |
| | | wait_converged() { |
| | | local start=$SECONDS hits=0 first= last= |
| | | # the publisher's 5 s latch) after the first ended. Sets CONVERGED_IN to the seconds from |
| | | # <start> (a value of SECONDS, now by default) until the first of them |
| | | wait_converged() { # [<start>] |
| | | local start=${1:-$SECONDS} hits=0 first= last= |
| | | until [ $hits -ge 3 ] && [ $((last - first)) -gt $((MONITORING_PERIOD + 5)) ]; do |
| | | last=$SECONDS |
| | | if converged_once; then hits=$((hits + 1)); first=${first:-$SECONDS}; else hits=0; first=; fi |