sycommon-python-lib 0.1.50__py3-none-any.whl → 0.1.51__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.
- sycommon/rabbitmq/rabbitmq_client.py +15 -11
- sycommon/services.py +1 -1
- {sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/METADATA +1 -1
- {sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/RECORD +7 -7
- {sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/top_level.txt +0 -0
|
@@ -53,7 +53,7 @@ class RabbitMQClient:
|
|
|
53
53
|
self.exchange_type = ExchangeType(exchange_type.lower())
|
|
54
54
|
except ValueError:
|
|
55
55
|
logger.warning(f"无效的exchange_type: {exchange_type},默认使用'topic'")
|
|
56
|
-
self.exchange_type = ExchangeType.TOPIC
|
|
56
|
+
self.exchange_type = ExchangeType.TOPIC
|
|
57
57
|
|
|
58
58
|
# 队列配置
|
|
59
59
|
self.queue_name = queue_name.strip() if queue_name else None
|
|
@@ -176,10 +176,6 @@ class RabbitMQClient:
|
|
|
176
176
|
self._channel_conn.close_callbacks.add(
|
|
177
177
|
self._conn_close_callback)
|
|
178
178
|
|
|
179
|
-
# 单通道池已设置prefetch_count,无需重复设置
|
|
180
|
-
logger.debug(f"使用连接池预配置的prefetch_count")
|
|
181
|
-
|
|
182
|
-
# 默认启用异步发布确认
|
|
183
179
|
# 重建交换机/队列资源
|
|
184
180
|
await self._rebuild_resources()
|
|
185
181
|
|
|
@@ -311,16 +307,24 @@ class RabbitMQClient:
|
|
|
311
307
|
return self._consumer_tag
|
|
312
308
|
|
|
313
309
|
async def stop_consuming(self) -> None:
|
|
314
|
-
"""
|
|
310
|
+
"""停止消息消费(修复:移除 _queue.is_closed 判断)"""
|
|
315
311
|
async with self._consume_lock:
|
|
316
312
|
try:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
# 判断 consumer_tag 和 queue 是否存在,通道状态通过 _channel 校验
|
|
314
|
+
if self._consumer_tag and self._queue and self._channel and not self._channel.is_closed:
|
|
315
|
+
# 用通道取消消费(队列无cancel方法)
|
|
316
|
+
await self._channel.basic_cancel(self._consumer_tag)
|
|
317
|
+
logger.info(
|
|
318
|
+
f"停止消费成功,consumer_tag: {self._consumer_tag},队列: {self._queue.name}")
|
|
319
|
+
elif self._consumer_tag and self._queue:
|
|
320
|
+
# 通道已关闭,无需执行cancel(消费已自动停止)
|
|
321
|
+
logger.warning(
|
|
322
|
+
f"通道已关闭,无需取消消费(consumer_tag: {self._consumer_tag})")
|
|
320
323
|
except Exception as e:
|
|
321
|
-
logger.error(
|
|
324
|
+
logger.error(
|
|
325
|
+
f"停止消费者 '{self._queue.name if self._queue else '未知队列'}' 时出错: {str(e)}", exc_info=True)
|
|
322
326
|
finally:
|
|
323
|
-
self._consumer_tag = None
|
|
327
|
+
self._consumer_tag = None # 无论成败,清理消费标签
|
|
324
328
|
|
|
325
329
|
async def publish(
|
|
326
330
|
self,
|
sycommon/services.py
CHANGED
|
@@ -70,7 +70,7 @@ class Services(metaclass=SingletonMeta):
|
|
|
70
70
|
app.state.config = {
|
|
71
71
|
"host": cls._config.get('Host', '0.0.0.0'),
|
|
72
72
|
"port": cls._config.get('Port', 8080),
|
|
73
|
-
"workers": cls._config.get('Workers',
|
|
73
|
+
"workers": cls._config.get('Workers', 1),
|
|
74
74
|
"h11_max_incomplete_event_size": cls._config.get('H11MaxIncompleteEventSize', 1024 * 1024 * 10)
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
command/cli.py,sha256=bP2LCLkRvfETIwWkVD70q5xFxMI4D3BpH09Ws1f-ENc,5849
|
|
2
2
|
sycommon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sycommon/services.py,sha256=
|
|
3
|
+
sycommon/services.py,sha256=SFMXZpVh4nGTocpdhu77qBWyFhLc-m95IV8CC4mh2ec,11121
|
|
4
4
|
sycommon/config/Config.py,sha256=9yO5b8WfvEDvkyrGrlwrLFasgh_-MjcEvGF20Gz5Xo4,3041
|
|
5
5
|
sycommon/config/DatabaseConfig.py,sha256=ILiUuYT9_xJZE2W-RYuC3JCt_YLKc1sbH13-MHIOPhg,804
|
|
6
6
|
sycommon/config/EmbeddingConfig.py,sha256=gPKwiDYbeu1GpdIZXMmgqM7JqBIzCXi0yYuGRLZooMI,362
|
|
@@ -35,7 +35,7 @@ sycommon/models/mqlistener_config.py,sha256=vXp2uMmd0XQ5B9noSRXWHewTy-juQ2y7IsWt
|
|
|
35
35
|
sycommon/models/mqmsg_model.py,sha256=cxn0M5b0utQK6crMYmL-1waeGYHvK3AlGaRy23clqTE,277
|
|
36
36
|
sycommon/models/mqsend_config.py,sha256=NQX9dc8PpuquMG36GCVhJe8omAW1KVXXqr6lSRU6D7I,268
|
|
37
37
|
sycommon/models/sso_user.py,sha256=i1WAN6k5sPcPApQEdtjpWDy7VrzWLpOrOQewGLGoGIw,2702
|
|
38
|
-
sycommon/rabbitmq/rabbitmq_client.py,sha256=
|
|
38
|
+
sycommon/rabbitmq/rabbitmq_client.py,sha256=KUMNklTXK2cc66fNpThnZZpPLwfRH4-AwLQ2rsGEePk,19898
|
|
39
39
|
sycommon/rabbitmq/rabbitmq_pool.py,sha256=QtUcK4HuepRqRmy5XkUQo8gDgj74fr77CX7T5rN0y4I,15640
|
|
40
40
|
sycommon/rabbitmq/rabbitmq_service.py,sha256=wpEJynP0gzbnmMyB02sfR9nTWB4hfTTP00xQxDJu644,38119
|
|
41
41
|
sycommon/sse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -52,8 +52,8 @@ sycommon/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
52
52
|
sycommon/tools/docs.py,sha256=OPj2ETheuWjXLyaXtaZPbwmJKfJaYXV5s4XMVAUNrms,1607
|
|
53
53
|
sycommon/tools/snowflake.py,sha256=DdEj3T5r5OEvikp3puxqmmmz6BrggxomoSlnsRFb5dM,1174
|
|
54
54
|
sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
|
|
55
|
-
sycommon_python_lib-0.1.
|
|
56
|
-
sycommon_python_lib-0.1.
|
|
57
|
-
sycommon_python_lib-0.1.
|
|
58
|
-
sycommon_python_lib-0.1.
|
|
59
|
-
sycommon_python_lib-0.1.
|
|
55
|
+
sycommon_python_lib-0.1.51.dist-info/METADATA,sha256=p5snEjLtK9zjIs4a4BySEavEY8FZn7Jw_XI4AtvLy2o,7037
|
|
56
|
+
sycommon_python_lib-0.1.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
57
|
+
sycommon_python_lib-0.1.51.dist-info/entry_points.txt,sha256=q_h2nbvhhmdnsOUZEIwpuoDjaNfBF9XqppDEmQn9d_A,46
|
|
58
|
+
sycommon_python_lib-0.1.51.dist-info/top_level.txt,sha256=98CJ-cyM2WIKxLz-Pf0AitWLhJyrfXvyY8slwjTXNuc,17
|
|
59
|
+
sycommon_python_lib-0.1.51.dist-info/RECORD,,
|
|
File without changes
|
{sycommon_python_lib-0.1.50.dist-info → sycommon_python_lib-0.1.51.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|