mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
chore: remove PostgreSQL lock timeout constants, retry attempts, retryable SQL states, and the _is_retryable_lock_error function
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user