aury-boot 0.0.42__py3-none-any.whl → 0.0.43__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.
- aury/boot/_version.py +2 -2
- aury/boot/infrastructure/cache/redis.py +12 -0
- aury/boot/infrastructure/channel/backends/redis_cluster.py +12 -0
- aury/boot/infrastructure/clients/redis/manager.py +12 -0
- aury/boot/infrastructure/mq/backends/redis_stream.py +17 -6
- {aury_boot-0.0.42.dist-info → aury_boot-0.0.43.dist-info}/METADATA +1 -1
- {aury_boot-0.0.42.dist-info → aury_boot-0.0.43.dist-info}/RECORD +9 -9
- {aury_boot-0.0.42.dist-info → aury_boot-0.0.43.dist-info}/WHEEL +0 -0
- {aury_boot-0.0.42.dist-info → aury_boot-0.0.43.dist-info}/entry_points.txt +0 -0
aury/boot/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
31
|
+
__version__ = version = '0.0.43'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 43)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -105,6 +105,8 @@ class RedisCache(ICache):
|
|
|
105
105
|
"""
|
|
106
106
|
try:
|
|
107
107
|
from coredis import RedisCluster
|
|
108
|
+
from coredis.retry import ConstantRetryPolicy
|
|
109
|
+
from coredis.exceptions import ConnectionError as CoredisConnectionError
|
|
108
110
|
except ImportError as exc:
|
|
109
111
|
raise ImportError(
|
|
110
112
|
"Redis Cluster 需要安装 coredis: pip install coredis"
|
|
@@ -123,11 +125,21 @@ class RedisCache(ICache):
|
|
|
123
125
|
password = username
|
|
124
126
|
username = None
|
|
125
127
|
|
|
128
|
+
# 配置更快的重试策略
|
|
129
|
+
retry_policy = ConstantRetryPolicy(
|
|
130
|
+
retries=3,
|
|
131
|
+
delay=1,
|
|
132
|
+
retryable_exceptions=(CoredisConnectionError, TimeoutError, OSError),
|
|
133
|
+
)
|
|
134
|
+
|
|
126
135
|
# 构建连接参数
|
|
127
136
|
cluster_kwargs: dict = {
|
|
128
137
|
"host": parsed.hostname or "localhost",
|
|
129
138
|
"port": parsed.port or 6379,
|
|
130
139
|
"decode_responses": False,
|
|
140
|
+
"connect_timeout": 5,
|
|
141
|
+
"stream_timeout": 5,
|
|
142
|
+
"retry_policy": retry_policy,
|
|
131
143
|
}
|
|
132
144
|
|
|
133
145
|
if username:
|
|
@@ -18,6 +18,8 @@ from aury.boot.common.logging import logger
|
|
|
18
18
|
|
|
19
19
|
try:
|
|
20
20
|
from coredis import RedisCluster
|
|
21
|
+
from coredis.retry import ConstantRetryPolicy
|
|
22
|
+
from coredis.exceptions import ConnectionError as CoredisConnectionError
|
|
21
23
|
except ImportError as exc:
|
|
22
24
|
raise ImportError(
|
|
23
25
|
"Redis Cluster Channel 需要安装 coredis: pip install coredis"
|
|
@@ -41,11 +43,21 @@ class RedisClusterBackend:
|
|
|
41
43
|
def __init__(self, url: str) -> None:
|
|
42
44
|
host, port, password = self._parse_url(url)
|
|
43
45
|
|
|
46
|
+
# 配置更快的重试策略
|
|
47
|
+
retry_policy = ConstantRetryPolicy(
|
|
48
|
+
retries=3,
|
|
49
|
+
delay=1,
|
|
50
|
+
retryable_exceptions=(CoredisConnectionError, TimeoutError, OSError),
|
|
51
|
+
)
|
|
52
|
+
|
|
44
53
|
self._client: RedisCluster = RedisCluster(
|
|
45
54
|
host=host,
|
|
46
55
|
port=port,
|
|
47
56
|
password=password,
|
|
48
57
|
decode_responses=True,
|
|
58
|
+
connect_timeout=5,
|
|
59
|
+
stream_timeout=5,
|
|
60
|
+
retry_policy=retry_policy,
|
|
49
61
|
)
|
|
50
62
|
self._pubsub: Any = None
|
|
51
63
|
self._queue: asyncio.Queue[Event] = asyncio.Queue()
|
|
@@ -211,6 +211,8 @@ class RedisClient:
|
|
|
211
211
|
"""
|
|
212
212
|
try:
|
|
213
213
|
from coredis import RedisCluster
|
|
214
|
+
from coredis.retry import ConstantRetryPolicy
|
|
215
|
+
from coredis.exceptions import ConnectionError as CoredisConnectionError
|
|
214
216
|
except ImportError as exc:
|
|
215
217
|
raise ImportError(
|
|
216
218
|
"Redis Cluster 需要安装 coredis: pip install coredis"
|
|
@@ -229,11 +231,21 @@ class RedisClient:
|
|
|
229
231
|
password = username
|
|
230
232
|
username = None
|
|
231
233
|
|
|
234
|
+
# 配置更快的重试策略(默认间隔太长)
|
|
235
|
+
retry_policy = ConstantRetryPolicy(
|
|
236
|
+
retries=3,
|
|
237
|
+
delay=1, # 1 秒重试间隔
|
|
238
|
+
retryable_exceptions=(CoredisConnectionError, TimeoutError, OSError),
|
|
239
|
+
)
|
|
240
|
+
|
|
232
241
|
# 构建连接参数
|
|
233
242
|
cluster_kwargs: dict = {
|
|
234
243
|
"host": parsed.hostname or "localhost",
|
|
235
244
|
"port": parsed.port or 6379,
|
|
236
245
|
"decode_responses": self._config.decode_responses,
|
|
246
|
+
"connect_timeout": self._config.socket_connect_timeout or 5,
|
|
247
|
+
"stream_timeout": self._config.socket_timeout or 5,
|
|
248
|
+
"retry_policy": retry_policy,
|
|
237
249
|
}
|
|
238
250
|
|
|
239
251
|
if username:
|
|
@@ -309,12 +309,23 @@ class RedisStreamMQ(IMQ):
|
|
|
309
309
|
await self._ensure_client()
|
|
310
310
|
stream_key = self._stream_key(queue)
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
312
|
+
# coredis 使用 start/end,redis-py 使用 min/max
|
|
313
|
+
if hasattr(self._client, 'is_cluster') and self._client.is_cluster:
|
|
314
|
+
# coredis API
|
|
315
|
+
result = await self._client.connection.xrange(
|
|
316
|
+
stream_key,
|
|
317
|
+
start=start,
|
|
318
|
+
end=end,
|
|
319
|
+
count=count,
|
|
320
|
+
)
|
|
321
|
+
else:
|
|
322
|
+
# redis-py API
|
|
323
|
+
result = await self._client.connection.xrange(
|
|
324
|
+
stream_key,
|
|
325
|
+
min=start,
|
|
326
|
+
max=end,
|
|
327
|
+
count=count,
|
|
328
|
+
)
|
|
318
329
|
|
|
319
330
|
messages = []
|
|
320
331
|
for msg_id, data in result:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
aury/boot/__init__.py,sha256=pCno-EInnpIBa1OtxNYF-JWf9j95Cd2h6vmu0xqa_-4,1791
|
|
2
|
-
aury/boot/_version.py,sha256=
|
|
2
|
+
aury/boot/_version.py,sha256=qJphZkKjg5qeGMzBrtqKwyJZQtcx3oaEh-0t6ejMuVo,706
|
|
3
3
|
aury/boot/application/__init__.py,sha256=I2KqNVdYg2q5nlOXr0TtFGyHmhj4oWdaR6ZB73Mwg7Y,3041
|
|
4
4
|
aury/boot/application/adapter/__init__.py,sha256=e1bcSb1bxUMfofTwiCuHBZJk5-STkMCWPF2EJXHQ7UU,3976
|
|
5
5
|
aury/boot/application/adapter/base.py,sha256=Ar_66fiHPDEmV-1DKnqXKwc53p3pozG31bgTJTEUriY,15763
|
|
@@ -143,13 +143,13 @@ aury/boot/infrastructure/cache/exceptions.py,sha256=KZsFIHXW3_kOh_KB93EVZJKbiDvD
|
|
|
143
143
|
aury/boot/infrastructure/cache/factory.py,sha256=aF74JoiiSKFgctqqh2Z8OtGRS2Am_ou-I40GyygLzC0,2489
|
|
144
144
|
aury/boot/infrastructure/cache/manager.py,sha256=2jlshbO4NqpPxH-8DBiMFNAvWuZUI3atUCsw9GGlzc8,16807
|
|
145
145
|
aury/boot/infrastructure/cache/memory.py,sha256=qGhLKKjGsEUHjVRFMV6A33MB_1iPaKCEEkT6VFrLkQY,9832
|
|
146
|
-
aury/boot/infrastructure/cache/redis.py,sha256=
|
|
146
|
+
aury/boot/infrastructure/cache/redis.py,sha256=OeLrjQ8jooJLItTr5xtgoxpb6WPw-HN3JpGNPQDvINA,10964
|
|
147
147
|
aury/boot/infrastructure/channel/__init__.py,sha256=zv3dNH4By8h-5Fksi18LFJVf5cXBmj0M49DjTfQL2w4,712
|
|
148
148
|
aury/boot/infrastructure/channel/base.py,sha256=xE_7vtgSB06PIq6HPh59MXXisjBuz530NmlnMwQxU5Q,3049
|
|
149
149
|
aury/boot/infrastructure/channel/manager.py,sha256=pTXhWTjRh83ifX9bKlsD4t5w1pZQOZszGbiy4wBYfJ8,7906
|
|
150
150
|
aury/boot/infrastructure/channel/backends/__init__.py,sha256=qRA8JuAueQXRfcqJSl-M2a1sRNscPjCQBgVmWn3DFu4,185
|
|
151
151
|
aury/boot/infrastructure/channel/backends/broadcaster.py,sha256=y8eKx6X6Iy9a_5vnLMm5gjqkq05SmJEWESw1-x0lIFg,4771
|
|
152
|
-
aury/boot/infrastructure/channel/backends/redis_cluster.py,sha256=
|
|
152
|
+
aury/boot/infrastructure/channel/backends/redis_cluster.py,sha256=KtPB0nHK76tyVFiD2Rs_LPbjyw0R-9CwM0R-xcy9cTY,4579
|
|
153
153
|
aury/boot/infrastructure/channel/backends/redis_cluster_channel.py,sha256=MAlo1mnyQzjhK1FwxeTiMvz_RpFjVuH3AgKKhAcH8Rs,4949
|
|
154
154
|
aury/boot/infrastructure/clients/__init__.py,sha256=1ANMejb3RrBgaR-jq-dsxJ0kQDRHz5jV-QvdUNcf_ok,435
|
|
155
155
|
aury/boot/infrastructure/clients/rabbitmq/__init__.py,sha256=cnU-W7jOcAgp_FvsY9EipNCeJzeA9gHLRuZ0yQZE2DI,200
|
|
@@ -157,7 +157,7 @@ aury/boot/infrastructure/clients/rabbitmq/config.py,sha256=YmvNiISpqNt-LE2Crpzmx
|
|
|
157
157
|
aury/boot/infrastructure/clients/rabbitmq/manager.py,sha256=a3Op0yN2DICnoqxOVb0DVT9RnoF8laN2EutOsOSWzWA,9659
|
|
158
158
|
aury/boot/infrastructure/clients/redis/__init__.py,sha256=HGZVfcWmOPeiAk-rJ8Yun7N5CQiPlGFofdByvl8Uqso,613
|
|
159
159
|
aury/boot/infrastructure/clients/redis/config.py,sha256=KfC2R7bcQ91zjTp8Q_S7j3ZemDLdejUYc3CrWsJlpNM,1421
|
|
160
|
-
aury/boot/infrastructure/clients/redis/manager.py,sha256=
|
|
160
|
+
aury/boot/infrastructure/clients/redis/manager.py,sha256=b8x-SD8wS_YSCjneS_63rCzRZOmojqxKiV0zpdjTJ4U,11697
|
|
161
161
|
aury/boot/infrastructure/database/__init__.py,sha256=MsHNyrJ2CZJT-lbVZzOAJ0nFfFEmHrJqC0zw-cFS768,888
|
|
162
162
|
aury/boot/infrastructure/database/config.py,sha256=5LYy4DuLL0XNjVnX2HUcrMh3c71eeZa-vWGM8QCkL0U,1408
|
|
163
163
|
aury/boot/infrastructure/database/exceptions.py,sha256=hUjsU23c0eMwogSDrKq_bQ6zvnY7PQSGaitbCEhhDZQ,766
|
|
@@ -197,7 +197,7 @@ aury/boot/infrastructure/mq/manager.py,sha256=Bu4E1Tgz0CzFvJuCS9_fBMj9eAqmXcZp8a
|
|
|
197
197
|
aury/boot/infrastructure/mq/backends/__init__.py,sha256=10nggw2V-AzuZ1vvzq_ksoXR4FI3e4BR36EfY49Pek4,200
|
|
198
198
|
aury/boot/infrastructure/mq/backends/rabbitmq.py,sha256=0NWgPKEwtbmI63EVvKINdfXXDNyOvuOOP9LlBzqH91E,5493
|
|
199
199
|
aury/boot/infrastructure/mq/backends/redis.py,sha256=B89U7mqIceUsCXE4G3u1u6aFM9hv4mmLLwuCYq1T9tQ,5281
|
|
200
|
-
aury/boot/infrastructure/mq/backends/redis_stream.py,sha256=
|
|
200
|
+
aury/boot/infrastructure/mq/backends/redis_stream.py,sha256=IAw-sn87uIV9YI65WaHF5dCTNdQd3hKWFcZI4AUCNvk,15173
|
|
201
201
|
aury/boot/infrastructure/scheduler/__init__.py,sha256=ji_K1OePMHt4CIFr168LGEbSuX8ybgrden-W75b0NdI,395
|
|
202
202
|
aury/boot/infrastructure/scheduler/exceptions.py,sha256=ROltrhSctVWA-6ulnjuYeHAk3ZF-sykDoesuierYzew,634
|
|
203
203
|
aury/boot/infrastructure/scheduler/manager.py,sha256=wUxMRGXpoAwjHnB4u7BKnzJbiPZE5sovuLPrgLoQYb4,23753
|
|
@@ -218,7 +218,7 @@ aury/boot/testing/client.py,sha256=KOg1EemuIVsBG68G5y0DjSxZGcIQVdWQ4ASaHE3o1R0,4
|
|
|
218
218
|
aury/boot/testing/factory.py,sha256=8GvwX9qIDu0L65gzJMlrWB0xbmJ-7zPHuwk3eECULcg,5185
|
|
219
219
|
aury/boot/toolkit/__init__.py,sha256=AcyVb9fDf3CaEmJPNkWC4iGv32qCPyk4BuFKSuNiJRQ,334
|
|
220
220
|
aury/boot/toolkit/http/__init__.py,sha256=5bv4Ntz1sbNFhP9zPLBDhB536ZX1CKIAOp-kQSKMRQ0,14161
|
|
221
|
-
aury_boot-0.0.
|
|
222
|
-
aury_boot-0.0.
|
|
223
|
-
aury_boot-0.0.
|
|
224
|
-
aury_boot-0.0.
|
|
221
|
+
aury_boot-0.0.43.dist-info/METADATA,sha256=WJz98j7foEbb61Ih5wMbApuApunDPlfEPiMjwNyBAvU,9179
|
|
222
|
+
aury_boot-0.0.43.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
223
|
+
aury_boot-0.0.43.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
|
|
224
|
+
aury_boot-0.0.43.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|