From b73889688289b5e6c6abc802a9f8fc3b1fbf828a Mon Sep 17 00:00:00 2001 From: nd Date: Thu, 14 May 2020 22:14:54 +0200 Subject: [PATCH] cleanup old challanges --- templates/pdns-letsencrypt.py.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/pdns-letsencrypt.py.j2 b/templates/pdns-letsencrypt.py.j2 index 019fa4a..6ce855e 100644 --- a/templates/pdns-letsencrypt.py.j2 +++ b/templates/pdns-letsencrypt.py.j2 @@ -27,7 +27,8 @@ def get_challenge(db, path): def add_challenge(db, path, value): c = db.cursor() - c.execute('REPLACE INTO challenges (q, value) VALUES(?, ?)', (path,value,)) + c.execute('INSERT INTO challenges (q, value) VALUES(?, ?)', (path,value,)) + c.execute("DELETE FROM challenges WHERE timestamp < strftime('%s', datetime('now','-2 day'))") db.commit() def main_query():