c2cwsgiutils 5.2.4__tar.gz → 5.2.5__tar.gz
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.
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/PKG-INFO +1 -1
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/redis_utils.py +29 -5
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/pyproject.toml +6 -6
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/LICENSE +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/README.md +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/composition.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/connection.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/image.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/print.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/acceptance/utils.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/auth.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/broadcast/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/broadcast/interface.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/broadcast/local.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/broadcast/redis.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/broadcast/utils.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/client_info.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/config_utils.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/coverage_setup.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/db.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/db_maintenance_view.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/debug/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/debug/_listeners.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/debug/_views.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/debug/utils.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/errors.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/health_check.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/index.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/loader.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/logging_view.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/metrics.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/models_graph.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/pretty_json.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/profiler.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/prometheus.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/py.typed +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/pyramid.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/pyramid_logging.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/redis_stats.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/request_tracking/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/request_tracking/_sql.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/scripts/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/scripts/check_es.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/scripts/genversion.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/scripts/stats_db.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/scripts/test_print.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sentry.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/services.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/setup_process.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sql_profiler/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sql_profiler/_impl.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/README.md +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/_filters.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/_models.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/examples/example.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/sqlalchemylogger/handlers.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/stats.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/stats_pyramid/__init__.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/stats_pyramid/_db_spy.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/stats_pyramid/_views.py +0 -0
- {c2cwsgiutils-5.2.4 → c2cwsgiutils-5.2.5}/c2cwsgiutils/version.py +0 -0
|
@@ -17,12 +17,16 @@ REDIS_OPTIONS_KEY = "C2C_REDIS_OPTIONS"
|
|
|
17
17
|
REDIS_SENTINELS_KEY = "C2C_REDIS_SENTINELS"
|
|
18
18
|
REDIS_SERVICENAME_KEY = "C2C_REDIS_SERVICENAME"
|
|
19
19
|
REDIS_DB_KEY = "C2C_REDIS_DB"
|
|
20
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY = "C2C_REDIS_PUBSUB_RETRY_DELAY"
|
|
21
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY = "C2C_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT"
|
|
20
22
|
|
|
21
23
|
REDIS_URL_KEY_PROP = "c2c.redis_url"
|
|
22
24
|
REDIS_OPTIONS_KEY_PROP = "c2c.redis_options"
|
|
23
25
|
REDIS_SENTINELS_KEY_PROP = "c2c.redis_sentinels"
|
|
24
26
|
REDIS_SERVICENAME_KEY_PROP = "c2c.redis_servicename"
|
|
25
27
|
REDIS_DB_KEY_PROP = "c2c.redis_db"
|
|
28
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP = "c2c.redis_pubsub_retry_delay"
|
|
29
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP = "c2c.redis_pubsub_get_message_timeout"
|
|
26
30
|
|
|
27
31
|
_master: Optional["redis.client.Redis[str]"] = None
|
|
28
32
|
_slave: Optional["redis.client.Redis[str]"] = None
|
|
@@ -93,10 +97,30 @@ def _init(settings: Optional[Mapping[str, Any]]) -> None:
|
|
|
93
97
|
class PubSubWorkerThread(threading.Thread):
|
|
94
98
|
"""A clone of redis.client.PubSubWorkerThread that doesn't die when the connections are broken."""
|
|
95
99
|
|
|
96
|
-
def __init__(
|
|
100
|
+
def __init__(
|
|
101
|
+
self,
|
|
102
|
+
pubsub: redis.client.PubSub,
|
|
103
|
+
name: str | None = None,
|
|
104
|
+
settings: Mapping[str, Any] | None = None,
|
|
105
|
+
) -> None:
|
|
106
|
+
"""Initialize the PubSubWorkerThread."""
|
|
97
107
|
super().__init__(name=name, daemon=True)
|
|
98
108
|
self.pubsub = pubsub
|
|
99
109
|
self._running = False
|
|
110
|
+
self._retry_delay = c2cwsgiutils.config_utils.env_or_settings(
|
|
111
|
+
settings,
|
|
112
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY,
|
|
113
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP,
|
|
114
|
+
0.5,
|
|
115
|
+
float,
|
|
116
|
+
)
|
|
117
|
+
self._get_message_timeout = c2cwsgiutils.config_utils.env_or_settings(
|
|
118
|
+
settings,
|
|
119
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY,
|
|
120
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP,
|
|
121
|
+
1.0,
|
|
122
|
+
float,
|
|
123
|
+
)
|
|
100
124
|
|
|
101
125
|
def run(self) -> None:
|
|
102
126
|
if self._running:
|
|
@@ -106,15 +130,15 @@ class PubSubWorkerThread(threading.Thread):
|
|
|
106
130
|
last_was_ok = True
|
|
107
131
|
while pubsub.subscribed:
|
|
108
132
|
try:
|
|
109
|
-
pubsub.get_message(ignore_subscribe_messages=True, timeout=
|
|
133
|
+
pubsub.get_message(ignore_subscribe_messages=True, timeout=self._get_message_timeout)
|
|
110
134
|
if not last_was_ok:
|
|
111
|
-
LOG.
|
|
135
|
+
LOG.debug("Redis is back")
|
|
112
136
|
last_was_ok = True
|
|
113
137
|
except redis.exceptions.RedisError:
|
|
114
138
|
if last_was_ok:
|
|
115
|
-
LOG.
|
|
139
|
+
LOG.debug("Redis connection problem")
|
|
116
140
|
last_was_ok = False
|
|
117
|
-
time.sleep(
|
|
141
|
+
time.sleep(self._retry_delay)
|
|
118
142
|
except Exception: # pylint: disable=broad-except
|
|
119
143
|
LOG.warning("Unexpected error", exc_info=True)
|
|
120
144
|
LOG.info("Redis subscription worker stopped")
|
|
@@ -21,7 +21,7 @@ strict = true
|
|
|
21
21
|
|
|
22
22
|
[tool.poetry]
|
|
23
23
|
name = "c2cwsgiutils"
|
|
24
|
-
version = "5.2.
|
|
24
|
+
version = "5.2.5"
|
|
25
25
|
description = "Common utilities for Camptocamp WSGI applications"
|
|
26
26
|
readme = "README.md"
|
|
27
27
|
authors = ["Camptocamp <info@camptocamp.com>"]
|
|
@@ -68,8 +68,8 @@ sentry = "c2cwsgiutils.sentry:filter_factory"
|
|
|
68
68
|
|
|
69
69
|
[tool.poetry.dependencies]
|
|
70
70
|
python = ">=3.8,<3.12"
|
|
71
|
-
requests = "2.32.
|
|
72
|
-
pyyaml = { version = "6.0.
|
|
71
|
+
requests = "2.32.4"
|
|
72
|
+
pyyaml = { version = "6.0.3" }
|
|
73
73
|
alembic = { version = "1.9.4", optional = true }
|
|
74
74
|
boltons = { version = "21.0.0", optional = true }
|
|
75
75
|
cornice = { version = "6.0.1", optional = true }
|
|
@@ -84,7 +84,7 @@ pyramid-tm = { version = "2.5", optional = true }
|
|
|
84
84
|
sentry-sdk = "2.8.0"
|
|
85
85
|
ujson = { version = "5.7.0", optional = true }
|
|
86
86
|
cee_syslog_handler = { version = "0.6.0", optional = true }
|
|
87
|
-
SQLAlchemy = { version = "2.0.
|
|
87
|
+
SQLAlchemy = { version = "2.0.46", optional = true }
|
|
88
88
|
SQLAlchemy-Utils = { version = "0.39.0", optional = true }
|
|
89
89
|
"zope.interface" = { version = "5.5.2", optional = true }
|
|
90
90
|
"zope.sqlalchemy" = { version = "1.6", optional = true }
|
|
@@ -92,7 +92,7 @@ pyjwt = { version = "2.6.0", optional = true }
|
|
|
92
92
|
requests-oauthlib = { version = "1.3.1", optional = true }
|
|
93
93
|
waitress = { version = "2.1.2", optional = true }
|
|
94
94
|
scikit-image = { version = "0.19.3", optional = true }
|
|
95
|
-
certifi = "
|
|
95
|
+
certifi = "2026.2.25"
|
|
96
96
|
scipy = { version = "1.10.1", optional = true }
|
|
97
97
|
pillow = { version = "10.3.0", optional = true }
|
|
98
98
|
urllib3 = "1.26.20"
|
|
@@ -158,7 +158,7 @@ junit2html = "30.1.6"
|
|
|
158
158
|
pytest = "7.2.2"
|
|
159
159
|
pytest-cov = "4.0.0"
|
|
160
160
|
pytest-html = "3.2.0"
|
|
161
|
-
types-pyyaml = "6.0.12.
|
|
161
|
+
types-pyyaml = "6.0.12.20241230"
|
|
162
162
|
types-requests = "2.28.11.17"
|
|
163
163
|
types-redis = "4.4.0.6"
|
|
164
164
|
types-ujson = "5.7.0.5"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|