diff --git a/roles/copr/backend/templates/cleanup-unused-vms-from-redis b/roles/copr/backend/templates/cleanup-unused-vms-from-redis index a628f25f3b..225c7665be 100644 --- a/roles/copr/backend/templates/cleanup-unused-vms-from-redis +++ b/roles/copr/backend/templates/cleanup-unused-vms-from-redis @@ -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"