cleanup old challanges

This commit is contained in:
nd 2020-05-14 22:14:54 +02:00
parent 417d4d66a1
commit b738896882
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9

View file

@ -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():