altcodepro-polydb-python 2.3.17__py3-none-any.whl → 2.3.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/METADATA +1 -1
- {altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/RECORD +10 -10
- polydb/__init__.py +0 -2
- polydb/adapters/PostgreSQLAdapter.py +51 -45
- polydb/databaseFactory.py +21 -101
- polydb/decorators.py +1031 -12
- polydb/retry.py +17 -7
- {altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/WHEEL +0 -0
- {altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/licenses/LICENSE +0 -0
- {altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/top_level.txt +0 -0
polydb/retry.py
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Retry logic with exponential backoff and metrics hooks
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
import functools
|
|
7
6
|
import time
|
|
8
7
|
import logging
|
|
9
8
|
from functools import wraps
|
|
10
|
-
from typing import Callable,
|
|
9
|
+
from typing import Callable, Tuple, Type
|
|
10
|
+
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
13
13
|
_NON_RETRYABLE_MARKERS = (
|
|
14
|
-
"23505",
|
|
15
|
-
"23503",
|
|
16
|
-
"23502",
|
|
17
|
-
"23514",
|
|
14
|
+
"23505", # Postgres unique_violation
|
|
15
|
+
"23503", # Postgres foreign_key_violation
|
|
16
|
+
"23502", # Postgres not_null_violation
|
|
17
|
+
"23514", # Postgres check_violation
|
|
18
18
|
"duplicate key value violates",
|
|
19
19
|
"unique constraint",
|
|
20
20
|
"UniqueViolation",
|
|
@@ -87,8 +87,18 @@ def retry(
|
|
|
87
87
|
MetricsHooks.on_query_end(func.__name__, duration, True)
|
|
88
88
|
return result
|
|
89
89
|
except exceptions as e:
|
|
90
|
-
attempt += 1
|
|
91
90
|
duration = time.time() - start_time
|
|
91
|
+
|
|
92
|
+
# Permanent errors (unique / FK / not-null / check
|
|
93
|
+
# violations, etc.) are never transient. Fail fast so the
|
|
94
|
+
# caller's insert->update fallthrough fires immediately
|
|
95
|
+
# instead of burning the full backoff window.
|
|
96
|
+
if _is_non_retryable(e):
|
|
97
|
+
MetricsHooks.on_query_end(func.__name__, duration, False)
|
|
98
|
+
MetricsHooks.on_error(func.__name__, e)
|
|
99
|
+
raise
|
|
100
|
+
|
|
101
|
+
attempt += 1
|
|
92
102
|
MetricsHooks.on_query_end(func.__name__, duration, False)
|
|
93
103
|
MetricsHooks.on_error(func.__name__, e)
|
|
94
104
|
|
{altcodepro_polydb_python-2.3.17.dist-info → altcodepro_polydb_python-2.3.20.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|