allow postgres db
Build and Push Docker Images / build-and-push (push) Successful in 5m22s

This commit is contained in:
2025-07-16 10:08:07 +02:00
parent 4e3ef5d207
commit 22b06f775d
8 changed files with 476 additions and 794 deletions
+6 -6
View File
@@ -1,11 +1,10 @@
import sqlite3
import time
from datetime import datetime
from app.database import DB_PATH, CACHE_EXPIRY_HOURS
from app.database import db_manager, CACHE_EXPIRY_HOURS
def clear_cache():
"""Clear the entire cache database"""
conn = sqlite3.connect(DB_PATH)
conn = db_manager.get_connection()
cursor = conn.cursor()
cursor.execute("DELETE FROM cache")
conn.commit()
@@ -14,7 +13,7 @@ def clear_cache():
def get_cache_stats():
"""Get cache statistics"""
conn = sqlite3.connect(DB_PATH)
conn = db_manager.get_connection()
cursor = conn.cursor()
# Get total entries
@@ -27,7 +26,7 @@ def get_cache_stats():
# Get recent entries (last 24 hours)
recent_timestamp = int(time.time()) - (24 * 60 * 60)
cursor.execute("SELECT COUNT(*) FROM cache WHERE timestamp > ?", (recent_timestamp,))
cursor.execute("SELECT COUNT(*) FROM cache WHERE timestamp > %s", (recent_timestamp,))
recent_entries = cursor.fetchone()[0]
# Get oldest entry timestamp
@@ -50,6 +49,7 @@ def get_cache_stats():
"recent_entries": recent_entries,
"oldest_entry": oldest_date,
"newest_entry": newest_date,
"cache_expiry_hours": CACHE_EXPIRY_HOURS
"cache_expiry_hours": CACHE_EXPIRY_HOURS,
"database_type": db_manager.db_type
}
}