mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-22 10:58:50 +00:00
Add table cleaning job (#3294)
This commit is contained in:
@@ -4,7 +4,7 @@ module Invidious::Database::Nonces
|
||||
extend self
|
||||
|
||||
# -------------------
|
||||
# Insert
|
||||
# Insert / Delete
|
||||
# -------------------
|
||||
|
||||
def insert(nonce : String, expire : Time)
|
||||
@@ -17,6 +17,15 @@ module Invidious::Database::Nonces
|
||||
PG_DB.exec(request, nonce, expire)
|
||||
end
|
||||
|
||||
def delete_expired
|
||||
request = <<-SQL
|
||||
DELETE FROM nonces *
|
||||
WHERE expire < now()
|
||||
SQL
|
||||
|
||||
PG_DB.exec(request)
|
||||
end
|
||||
|
||||
# -------------------
|
||||
# Update
|
||||
# -------------------
|
||||
|
||||
Reference in New Issue
Block a user