From 94d146627e3fb09df49f465658c9dd2d5e9e8e62 Mon Sep 17 00:00:00 2001 From: codl Date: Sat, 13 Mar 2021 01:46:27 +0100 Subject: [PATCH] add rudimentary check for recent last_delete (#400) --- routes/api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routes/api.py b/routes/api.py index f6fa1da..fa7c707 100644 --- a/routes/api.py +++ b/routes/api.py @@ -19,6 +19,12 @@ def api_status_check(): except Exception: return ('Redis bad', 500) + if db.session.execute(db.text(""" + SELECT count(*) FROM accounts + WHERE last_delete > now() - '10 minutes'::INTERVAL; + """)).fetchone() < 1: + return ('Deletes stalled', 500) + return 'OK'