c2cwsgiutils 6.2.0.dev330__tar.gz → 6.2.0.dev333__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.dev333}/PKG-INFO +1 -1
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/redis_utils.py +28 -5
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/pyproject.toml +1 -1
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/connection.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/image.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/package-lock.json +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/package.json +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/print.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/screenshot.js +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/auth.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/broadcast/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/broadcast/interface.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/broadcast/local.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/broadcast/redis.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/broadcast/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/client_info.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/config_utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/coverage_setup.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/db.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/db_maintenance_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/debug/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/debug/_listeners.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/debug/_views.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/debug/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/errors.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/health_check.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/index.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/loader.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/logging_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/models_graph.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/pretty_json.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/profiler.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/prometheus.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/py.typed +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/pyramid.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/pyramid_logging.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/redis_stats.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/request_tracking/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/request_tracking/_sql.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/scripts/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/scripts/genversion.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/scripts/stats_db.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/scripts/test_print.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sentry.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/services.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/setup_process.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sql_profiler/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sql_profiler/_impl.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/_filters.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/_models.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/examples/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/examples/example.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/handlers.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/static/favicon-16x16.png +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/static/favicon-32x32.png +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/_db_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/templates/index.html.mako +0 -0
- {c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/version.py +0 -0
|
@@ -18,12 +18,16 @@ _REDIS_OPTIONS_KEY = "C2C_REDIS_OPTIONS"
|
|
|
18
18
|
REDIS_SENTINELS_KEY = "C2C_REDIS_SENTINELS"
|
|
19
19
|
REDIS_SERVICENAME_KEY = "C2C_REDIS_SERVICENAME"
|
|
20
20
|
_REDIS_DB_KEY = "C2C_REDIS_DB"
|
|
21
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY = "C2C_REDIS_PUBSUB_RETRY_DELAY"
|
|
22
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY = "C2C_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT"
|
|
21
23
|
|
|
22
24
|
REDIS_URL_KEY_PROP = "c2c.redis_url"
|
|
23
25
|
_REDIS_OPTIONS_KEY_PROP = "c2c.redis_options"
|
|
24
26
|
REDIS_SENTINELS_KEY_PROP = "c2c.redis_sentinels"
|
|
25
27
|
REDIS_SERVICENAME_KEY_PROP = "c2c.redis_servicename"
|
|
26
28
|
_REDIS_DB_KEY_PROP = "c2c.redis_db"
|
|
29
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP = "c2c.redis_pubsub_retry_delay"
|
|
30
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP = "c2c.redis_pubsub_get_message_timeout"
|
|
27
31
|
|
|
28
32
|
_master: Optional["redis.client.Redis[str]"] = None
|
|
29
33
|
_slave: Optional["redis.client.Redis[str]"] = None
|
|
@@ -107,11 +111,30 @@ def _init(settings: Mapping[str, Any] | None) -> None:
|
|
|
107
111
|
class PubSubWorkerThread(threading.Thread):
|
|
108
112
|
"""A clone of redis.client.PubSubWorkerThread that doesn't die when the connections are broken."""
|
|
109
113
|
|
|
110
|
-
def __init__(
|
|
114
|
+
def __init__(
|
|
115
|
+
self,
|
|
116
|
+
pubsub: redis.client.PubSub,
|
|
117
|
+
name: str | None = None,
|
|
118
|
+
settings: Mapping[str, Any] | None = None,
|
|
119
|
+
) -> None:
|
|
111
120
|
"""Initialize the PubSubWorkerThread."""
|
|
112
121
|
super().__init__(name=name, daemon=True)
|
|
113
122
|
self.pubsub = pubsub
|
|
114
123
|
self._running = False
|
|
124
|
+
self._retry_delay = c2cwsgiutils.config_utils.env_or_settings(
|
|
125
|
+
settings,
|
|
126
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY,
|
|
127
|
+
_REDIS_PUBSUB_RETRY_DELAY_KEY_PROP,
|
|
128
|
+
0.5,
|
|
129
|
+
float,
|
|
130
|
+
)
|
|
131
|
+
self._get_message_timeout = c2cwsgiutils.config_utils.env_or_settings(
|
|
132
|
+
settings,
|
|
133
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY,
|
|
134
|
+
_REDIS_PUBSUB_GET_MESSAGE_TIMEOUT_KEY_PROP,
|
|
135
|
+
1.0,
|
|
136
|
+
float,
|
|
137
|
+
)
|
|
115
138
|
|
|
116
139
|
def run(self) -> None:
|
|
117
140
|
"""Run the worker."""
|
|
@@ -122,15 +145,15 @@ class PubSubWorkerThread(threading.Thread):
|
|
|
122
145
|
last_was_ok = True
|
|
123
146
|
while pubsub.subscribed:
|
|
124
147
|
try:
|
|
125
|
-
pubsub.get_message(ignore_subscribe_messages=True, timeout=
|
|
148
|
+
pubsub.get_message(ignore_subscribe_messages=True, timeout=self._get_message_timeout)
|
|
126
149
|
if not last_was_ok:
|
|
127
|
-
_LOG.
|
|
150
|
+
_LOG.debug("Redis is back")
|
|
128
151
|
last_was_ok = True
|
|
129
152
|
except redis.exceptions.RedisError:
|
|
130
153
|
if last_was_ok:
|
|
131
|
-
_LOG.
|
|
154
|
+
_LOG.debug("Redis connection problem")
|
|
132
155
|
last_was_ok = False
|
|
133
|
-
time.sleep(
|
|
156
|
+
time.sleep(self._retry_delay)
|
|
134
157
|
except Exception: # noqa: BLE001
|
|
135
158
|
_LOG.warning("Unexpected error", exc_info=True)
|
|
136
159
|
_LOG.info("Redis subscription worker stopped")
|
|
@@ -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.dev333"
|
|
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
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/connection.py
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/package-lock.json
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/package.json
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/acceptance/screenshot.js
RENAMED
|
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
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/request_tracking/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/request_tracking/_sql.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sql_profiler/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/README.md
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/_filters.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/sqlalchemylogger/handlers.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/static/favicon-16x16.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/static/favicon-32x32.png
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/__init__.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/_db_spy.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py
RENAMED
|
File without changes
|
{c2cwsgiutils-6.2.0.dev330 → c2cwsgiutils-6.2.0.dev333}/c2cwsgiutils/templates/index.html.mako
RENAMED
|
File without changes
|
|
File without changes
|