fix pagination cache
Build and Push Docker Images / build-and-push (push) Successful in 22s

This commit is contained in:
2025-07-03 13:22:19 +02:00
parent 0525f42ab8
commit 8c4a27c87e
+7 -2
View File
@@ -90,9 +90,14 @@ def init_db():
def get_cached_data(url, route):
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 60 * 60) # Convert hours to seconds
# Calculate cache expiry time
if route == 'pagination':
cache_expiry = cache_expiry * 31
# Pagination cache expires after 31 times the normal cache expiry
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 31 * 60 * 60)
else:
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 60 * 60) # Convert hours to seconds
cursor.execute(
"SELECT data FROM cache WHERE url = ? AND route = ? AND timestamp > ?",
(url, route, cache_expiry)