From bd74d3a423b1d4983b2cb8f5540172384f03ff8e Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:21:13 +0100 Subject: [PATCH] chore: remove PostgreSQL lock timeout constants, retry attempts, retryable SQL states, and the `_is_retryable_lock_error` function --- comet/services/torrent_manager.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/comet/services/torrent_manager.py b/comet/services/torrent_manager.py index 5d9c88c..fa5bc77 100644 --- a/comet/services/torrent_manager.py +++ b/comet/services/torrent_manager.py @@ -503,10 +503,6 @@ POSTGRES_UPDATE_SET = """ ) """ -POSTGRES_LOCK_TIMEOUT = "750ms" -POSTGRES_LOCK_RETRY_ATTEMPTS = 1 -POSTGRES_RETRYABLE_SQLSTATES = {"55P03", "40P01"} - POSTGRES_CONFLICT_TARGETS = { "series": "(media_id, info_hash, season, episode) WHERE season IS NOT NULL AND episode IS NOT NULL", "season_only": "(media_id, info_hash, season) WHERE season IS NOT NULL AND episode IS NULL", @@ -715,12 +711,4 @@ async def _upsert_torrent_record(params: dict): await database.execute(query, params) -def _is_retryable_lock_error(exc: Exception) -> bool: - sqlstate = getattr(exc, "sqlstate", None) - if sqlstate in POSTGRES_RETRYABLE_SQLSTATES: - return True - message = str(exc).lower() - return "lock timeout" in message or "deadlock detected" in message - - torrent_update_queue = TorrentUpdateQueue()