c2cwsgiutils 6.2.0.dev330__tar.gz → 6.2.0.dev336__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-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/PKG-INFO +1 -1
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/connection.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/image.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/print.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/utils.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/auth.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/broadcast/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/broadcast/interface.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/broadcast/local.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/broadcast/redis.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/broadcast/utils.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/client_info.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/config_utils.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/coverage_setup.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/db.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/db_maintenance_view.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/debug/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/debug/_listeners.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/debug/_views.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/debug/utils.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/errors.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/health_check.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/index.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/loader.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/logging_view.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/models_graph.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/pretty_json.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/profiler.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/prometheus.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/pyramid.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/pyramid_logging.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/redis_stats.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/redis_utils.py +30 -5
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/request_tracking/__init__.py +4 -2
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/request_tracking/_sql.py +2 -0
- c2cwsgiutils-6.2.0.dev336/c2cwsgiutils/scripts/__init__.py +1 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/scripts/genversion.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/scripts/stats_db.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/scripts/test_print.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sentry.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/services.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/setup_process.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sql_profiler/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sql_profiler/_impl.py +2 -0
- c2cwsgiutils-6.2.0.dev336/c2cwsgiutils/sqlalchemylogger/__init__.py +1 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/_filters.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/_models.py +2 -0
- c2cwsgiutils-6.2.0.dev336/c2cwsgiutils/sqlalchemylogger/examples/__init__.py +1 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/examples/example.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/handlers.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/stats_pyramid/__init__.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/stats_pyramid/_db_spy.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/version.py +2 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/pyproject.toml +2 -2
- c2cwsgiutils-6.2.0.dev330/c2cwsgiutils/scripts/__init__.py +0 -0
- c2cwsgiutils-6.2.0.dev330/c2cwsgiutils/sqlalchemylogger/__init__.py +0 -0
- c2cwsgiutils-6.2.0.dev330/c2cwsgiutils/sqlalchemylogger/examples/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/package-lock.json +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/package.json +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/screenshot.js +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/py.typed +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/static/favicon-16x16.png +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/static/favicon-32x32.png +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/templates/index.html.mako +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Copyright (c) 2026, Camptocamp SA
|
|
2
|
+
|
|
1
3
|
import logging
|
|
2
4
|
import threading
|
|
3
5
|
import time
|
|
@@ -18,12 +20,16 @@ _REDIS_OPTIONS_KEY = "C2C_REDIS_OPTIONS"
|
|
|
18
20
|
REDIS_SENTINELS_KEY = "C2C_REDIS_SENTINELS"
|
|
19
21
|
REDIS_SERVICENAME_KEY = "C2C_REDIS_SERVICENAME"
|
|
20
22
|
_REDIS_DB_KEY = "C2C_REDIS_DB"
|
|
23
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY = "C2C_REDIS_PUBSUB_RETRY_DELAY"
|
|
24
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY = "C2C_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT"
|
|
21
25
|
|
|
22
26
|
REDIS_URL_KEY_PROP = "c2c.redis_url"
|
|
23
27
|
_REDIS_OPTIONS_KEY_PROP = "c2c.redis_options"
|
|
24
28
|
REDIS_SENTINELS_KEY_PROP = "c2c.redis_sentinels"
|
|
25
29
|
REDIS_SERVICENAME_KEY_PROP = "c2c.redis_servicename"
|
|
26
30
|
_REDIS_DB_KEY_PROP = "c2c.redis_db"
|
|
31
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP = "c2c.redis_pubsub_retry_delay"
|
|
32
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP = "c2c.redis_pubsub_get_message_timeout"
|
|
27
33
|
|
|
28
34
|
_master: Optional["redis.client.Redis[str]"] = None
|
|
29
35
|
_slave: Optional["redis.client.Redis[str]"] = None
|
|
@@ -107,11 +113,30 @@ def _init(settings: Mapping[str, Any] | None) -> None:
|
|
|
107
113
|
class PubSubWorkerThread(threading.Thread):
|
|
108
114
|
"""A clone of redis.client.PubSubWorkerThread that doesn't die when the connections are broken."""
|
|
109
115
|
|
|
110
|
-
def __init__(
|
|
116
|
+
def __init__(
|
|
117
|
+
self,
|
|
118
|
+
pubsub: redis.client.PubSub,
|
|
119
|
+
name: str | None = None,
|
|
120
|
+
settings: Mapping[str, Any] | None = None,
|
|
121
|
+
) -> None:
|
|
111
122
|
"""Initialize the PubSubWorkerThread."""
|
|
112
123
|
super().__init__(name=name, daemon=True)
|
|
113
124
|
self.pubsub = pubsub
|
|
114
125
|
self._running = False
|
|
126
|
+
self._retry_delay = c2cwsgiutils.config_utils.env_or_settings(
|
|
127
|
+
settings,
|
|
128
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY,
|
|
129
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP,
|
|
130
|
+
0.5,
|
|
131
|
+
float,
|
|
132
|
+
)
|
|
133
|
+
self._get_message_timeout = c2cwsgiutils.config_utils.env_or_settings(
|
|
134
|
+
settings,
|
|
135
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY,
|
|
136
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP,
|
|
137
|
+
1.0,
|
|
138
|
+
float,
|
|
139
|
+
)
|
|
115
140
|
|
|
116
141
|
def run(self) -> None:
|
|
117
142
|
"""Run the worker."""
|
|
@@ -122,15 +147,15 @@ class PubSubWorkerThread(threading.Thread):
|
|
|
122
147
|
last_was_ok = True
|
|
123
148
|
while pubsub.subscribed:
|
|
124
149
|
try:
|
|
125
|
-
pubsub.get_message(ignore_subscribe_messages=True, timeout=
|
|
150
|
+
pubsub.get_message(ignore_subscribe_messages=True, timeout=self._get_message_timeout)
|
|
126
151
|
if not last_was_ok:
|
|
127
|
-
_LOG.
|
|
152
|
+
_LOG.debug("Redis is back")
|
|
128
153
|
last_was_ok = True
|
|
129
154
|
except redis.exceptions.RedisError:
|
|
130
155
|
if last_was_ok:
|
|
131
|
-
_LOG.
|
|
156
|
+
_LOG.debug("Redis connection problem")
|
|
132
157
|
last_was_ok = False
|
|
133
|
-
time.sleep(
|
|
158
|
+
time.sleep(self._retry_delay)
|
|
134
159
|
except Exception: # noqa: BLE001
|
|
135
160
|
_LOG.warning("Unexpected error", exc_info=True)
|
|
136
161
|
_LOG.info("Redis subscription worker stopped")
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/request_tracking/__init__.py
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Copyright (c) 2026, Camptocamp SA
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
4
|
Allows to track the request_id in the logs, the DB and others.
|
|
3
5
|
|
|
@@ -43,9 +45,9 @@ def _patch_requests() -> None:
|
|
|
43
45
|
self: requests.adapters.HTTPAdapter,
|
|
44
46
|
request: requests.models.PreparedRequest,
|
|
45
47
|
stream: bool = False,
|
|
46
|
-
timeout:
|
|
48
|
+
timeout: float | tuple[float, float] | tuple[float, None] | None = None,
|
|
47
49
|
verify: bool | str = True,
|
|
48
|
-
cert:
|
|
50
|
+
cert: bytes | str | tuple[bytes | str, bytes | str] | None = None,
|
|
49
51
|
proxies: Mapping[str, str] | None = None,
|
|
50
52
|
) -> requests.Response:
|
|
51
53
|
pyramid_request = get_current_request()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Copyright (c) 2026, Camptocamp SA
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Copyright (c) 2026, Camptocamp SA
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Copyright (c) 2026, Camptocamp SA
|
|
@@ -160,7 +160,7 @@ test_images = ["scikit-image"]
|
|
|
160
160
|
|
|
161
161
|
[tool.poetry.group.dev.dependencies]
|
|
162
162
|
# pylint = { version = "2.15.6" }
|
|
163
|
-
prospector = { version = "1.19.
|
|
163
|
+
prospector = { version = "1.19.1", extras = ["with_bandit", "with_mypy", "with_pyroma", "with_ruff"] }
|
|
164
164
|
prospector-profile-duplicated = "1.12.0"
|
|
165
165
|
prospector-profile-utils = "1.27.0"
|
|
166
166
|
junit2html = "31.1.4"
|
|
@@ -227,7 +227,7 @@ include = [
|
|
|
227
227
|
]
|
|
228
228
|
requires-python = ">=3.11"
|
|
229
229
|
dependencies = ["requests", "pyyaml", "ujson", "cee_syslog_handler", "prometheus-client", "setuptools<81.0.0"]
|
|
230
|
-
version = "6.2.0.
|
|
230
|
+
version = "6.2.0.dev336"
|
|
231
231
|
|
|
232
232
|
[project.urls]
|
|
233
233
|
repository = "https://github.com/camptocamp/c2cwsgiutils"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/package-lock.json
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/package.json
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/acceptance/screenshot.js
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/sqlalchemylogger/README.md
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/static/favicon-16x16.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/static/favicon-32x32.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev336}/c2cwsgiutils/templates/index.html.mako
RENAMED
|
File without changes
|