diff options
author | Konstantinos Natsakis <5933427+knatsakis@users.noreply.github.com> | 2019-11-01 11:38:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-01 11:38:25 +0200 |
commit | 2657f911421a8c4861abf8ebc3a51700bdf34524 (patch) | |
tree | 4681d2ffe9642cd449891d512035e6e29c20ec26 /.travis/utils.sh | |
parent | 590c835f7dbbb51bc0976c4a0b86e581389166f3 (diff) |
.travis.yml: Prevent nightly jobs from timing out (again) (#7238)
* .travis.yml: Add tick() and retry() functions
* .travis.yml: Remove superfluous 'docker info' commands
The docker info command is ran during the install phase. There is no
need to run it again
* .travis.yml: Use the tick() function instead of travis_wait()
Diffstat (limited to '.travis/utils.sh')
-rw-r--r-- | .travis/utils.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/.travis/utils.sh b/.travis/utils.sh new file mode 100644 index 0000000000..58ce47f0ae --- /dev/null +++ b/.travis/utils.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Prevent travis from timing out after 10 minutes of no output +tick() { + (while true; do sleep 300; echo; done) & + local PID=$! + disown + + "$@" + local RET=$? + + kill $PID + return $RET +} + +retry() { + local tries=$1 + shift + + local i=0 + while [ "$i" -lt "$tries" ]; do + "$@" && return 0 + sleep $((2**((i++)))) + done + + return 1 +} |