From a52e5c06a57f6c7d36d2eeb6cf68779b9a6d92f5 Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:55:08 +0100 Subject: [PATCH] fix: add explicit BIGINT casting to timestamp comparisons in cache cleanup queries --- comet/core/database.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/comet/core/database.py b/comet/core/database.py index 8d804bc..e8a1de3 100644 --- a/comet/core/database.py +++ b/comet/core/database.py @@ -571,7 +571,7 @@ async def _run_startup_cleanup(): await database.execute( """ DELETE FROM first_searches - WHERE timestamp < :current_time - :cache_ttl; + WHERE timestamp < CAST(:current_time AS BIGINT) - CAST(:cache_ttl AS BIGINT); """, {"cache_ttl": settings.TORRENT_CACHE_TTL, "current_time": current_time}, ) @@ -579,7 +579,7 @@ async def _run_startup_cleanup(): await database.execute( """ DELETE FROM metadata_cache - WHERE timestamp < :current_time - :cache_ttl; + WHERE timestamp < CAST(:current_time AS BIGINT) - CAST(:cache_ttl AS BIGINT); """, {"cache_ttl": settings.METADATA_CACHE_TTL, "current_time": current_time}, ) @@ -588,7 +588,7 @@ async def _run_startup_cleanup(): await database.execute( """ DELETE FROM torrents - WHERE timestamp < :current_time - :cache_ttl; + WHERE timestamp < CAST(:current_time AS BIGINT) - CAST(:cache_ttl AS BIGINT); """, {"cache_ttl": settings.TORRENT_CACHE_TTL, "current_time": current_time}, ) @@ -596,7 +596,7 @@ async def _run_startup_cleanup(): await database.execute( """ DELETE FROM debrid_availability - WHERE timestamp < :current_time - :cache_ttl; + WHERE timestamp < CAST(:current_time AS BIGINT) - CAST(:cache_ttl AS BIGINT); """, {"cache_ttl": settings.DEBRID_CACHE_TTL, "current_time": current_time}, ) @@ -604,7 +604,7 @@ async def _run_startup_cleanup(): await database.execute( """ DELETE FROM digital_release_cache - WHERE timestamp < :current_time - :cache_ttl; + WHERE timestamp < CAST(:current_time AS BIGINT) - CAST(:cache_ttl AS BIGINT); """, {"cache_ttl": settings.METADATA_CACHE_TTL, "current_time": current_time}, )