From be5c5e87a8bac59000b503c227e181ead6760540 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 1 Jul 2021 13:05:41 +0200 Subject: Print list of timed out games that are being deleted and abandoned. --- tools/purge.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/purge.sh b/tools/purge.sh index 58e1431..a47bcdd 100644 --- a/tools/purge.sh +++ b/tools/purge.sh @@ -2,5 +2,13 @@ # Clean out stale games from the database. -sqlite3 db "DELETE FROM games WHERE status = 0 AND mtime < datetime('now', '-7 days')" -sqlite3 db "UPDATE games SET status = 3 WHERE status = 1 AND mtime < datetime('now', '-14 days')" +WHERE_TIMEOUT_OPEN="WHERE status = 0 AND mtime < datetime('now', '-7 days')" +WHERE_TIMEOUT_ACTIVE="WHERE status = 1 AND mtime < datetime('now', '-14 days')" + +echo "--- TIMED OUT OPEN GAMES ---" +sqlite3 db "SELECT * FROM game_view $WHERE_TIMEOUT_OPEN" +sqlite3 db "DELETE FROM games $WHERE_TIMEOUT_OPEN" + +echo "--- TIMED OUT ACTIVE GAMES ---" +sqlite3 db "SELECT * FROM game_view $WHERE_TIMEOUT_ACTIVE" +sqlite3 db "UPDATE games SET status = 3 $WHERE_TIMEOUT_ACTIVE" -- cgit v1.2.3