copr-be: bugfix cleanup-unused-vms-from-redis

Since can be empty for some reason, handle that case.
This commit is contained in:
Pavel Raiskup 2020-04-21 10:58:12 +02:00 committed by Pierre-Yves Chibon
parent 02f11348b9
commit 136f444247

View file

@ -36,8 +36,11 @@ for worker; do
since=$(redis-cli hget "$worker" in_use_since)
remove=$(python -c "import time; out = ':' if time.time() - $since > 1800 else 'false'; print(out)")
# race, hopefully - the in_use_since field is not yet set even though the
# worker is assigned to build
test -n "$since" || continue
remove=$(python -c "import time; out = ':' if time.time() - $since > 1800 else 'false'; print(out)")
! $remove && continue
echo >&2 "REMOVING $since -- $worker"