chore: remove PostgreSQL lock timeout constants, retry attempts, retryable SQL states, and the _is_retryable_lock_error function

This commit is contained in:
g0ldyy
2026-01-05 13:21:13 +01:00
parent c251183368
commit bd74d3a423
-12
View File
@@ -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()