sycommon-python-lib 0.1.42__py3-none-any.whl → 0.1.44__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/middleware/traceid.py +1 -1
- sycommon/rabbitmq/rabbitmq_client.py +83 -13
- sycommon/rabbitmq/rabbitmq_pool.py +333 -259
- sycommon/rabbitmq/rabbitmq_service.py +23 -23
- sycommon/services.py +2 -1
- sycommon/synacos/feign.py +9 -8
- sycommon/synacos/nacos_service.py +65 -46
- {sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/METADATA +7 -7
- {sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/RECORD +12 -12
- {sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/WHEEL +0 -0
- {sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/entry_points.txt +0 -0
- {sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/top_level.txt +0 -0
|
@@ -56,7 +56,7 @@ class RabbitMQService:
|
|
|
56
56
|
# 连接状态监控任务
|
|
57
57
|
_connection_monitor_task: Optional[asyncio.Task] = None
|
|
58
58
|
# 重连配置
|
|
59
|
-
RECONNECT_INTERVAL =
|
|
59
|
+
RECONNECT_INTERVAL = 15 # 重连基础间隔(秒)
|
|
60
60
|
MAX_RECONNECT_ATTEMPTS = 10 # 最大连续重连次数
|
|
61
61
|
|
|
62
62
|
@classmethod
|
|
@@ -118,10 +118,6 @@ class RabbitMQService:
|
|
|
118
118
|
username=cls._config.get('username', ""),
|
|
119
119
|
password=cls._config.get('password', ""),
|
|
120
120
|
virtualhost=cls._config.get('virtual-host', "/"),
|
|
121
|
-
connection_pool_size=cls._config.get(
|
|
122
|
-
'connection_pool_size', 5),
|
|
123
|
-
channel_pool_size=cls._config.get('channel_pool_size', 10),
|
|
124
|
-
heartbeat=cls._config.get('heartbeat', 30),
|
|
125
121
|
app_name=cls._config.get("APP_NAME", "")
|
|
126
122
|
)
|
|
127
123
|
|
|
@@ -142,8 +138,7 @@ class RabbitMQService:
|
|
|
142
138
|
logger.info("RabbitMQ连接监控任务启动")
|
|
143
139
|
while not cls._is_shutdown:
|
|
144
140
|
try:
|
|
145
|
-
#
|
|
146
|
-
await asyncio.sleep(5)
|
|
141
|
+
await asyncio.sleep(cls.RECONNECT_INTERVAL) # 固定15秒间隔
|
|
147
142
|
|
|
148
143
|
# 跳过未初始化的连接池
|
|
149
144
|
if not cls._connection_pool or not cls._connection_pool._initialized:
|
|
@@ -213,6 +208,10 @@ class RabbitMQService:
|
|
|
213
208
|
@classmethod
|
|
214
209
|
async def _reconnect_client(cls, client_name: str, client: RabbitMQClient) -> bool:
|
|
215
210
|
"""客户端重连(带重试机制)"""
|
|
211
|
+
# 重连冷却,避免任务堆积
|
|
212
|
+
cooldown = cls.RECONNECT_INTERVAL * 2
|
|
213
|
+
await asyncio.sleep(cooldown)
|
|
214
|
+
|
|
216
215
|
for attempt in range(cls.MAX_RECONNECT_ATTEMPTS):
|
|
217
216
|
try:
|
|
218
217
|
# 执行重连
|
|
@@ -237,20 +236,14 @@ class RabbitMQService:
|
|
|
237
236
|
else:
|
|
238
237
|
logger.warning(
|
|
239
238
|
f"客户端 '{client_name}' 重连尝试 {attempt+1} 失败:资源未完全初始化")
|
|
240
|
-
|
|
241
|
-
except aio_pika_exceptions.AMQPConnectionError as e:
|
|
242
|
-
logger.error(
|
|
243
|
-
f"客户端 '{client_name}' 重连尝试 {attempt+1} 失败(连接错误): {str(e)}")
|
|
244
|
-
except aio_pika_exceptions.AMQPChannelError as e:
|
|
245
|
-
logger.error(
|
|
246
|
-
f"客户端 '{client_name}' 重连尝试 {attempt+1} 失败(通道错误): {str(e)}")
|
|
247
239
|
except Exception as e:
|
|
248
240
|
logger.error(
|
|
249
241
|
f"客户端 '{client_name}' 重连尝试 {attempt+1} 失败: {str(e)}", exc_info=True)
|
|
250
242
|
|
|
251
|
-
|
|
252
|
-
await asyncio.sleep(cls.RECONNECT_INTERVAL * (2 ** attempt))
|
|
243
|
+
await asyncio.sleep(cls.RECONNECT_INTERVAL)
|
|
253
244
|
|
|
245
|
+
if not cls._is_shutdown:
|
|
246
|
+
asyncio.create_task(cls._reconnect_client(client_name, client))
|
|
254
247
|
return False
|
|
255
248
|
|
|
256
249
|
@classmethod
|
|
@@ -587,9 +580,19 @@ class RabbitMQService:
|
|
|
587
580
|
logger.warning("服务已关闭,无法启动消费者")
|
|
588
581
|
return
|
|
589
582
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
583
|
+
# 检查任务状态,避免重复创建
|
|
584
|
+
if client_name in cls._consumer_tasks:
|
|
585
|
+
existing_task = cls._consumer_tasks[client_name]
|
|
586
|
+
if not existing_task.done():
|
|
587
|
+
# 检查任务是否处于异常状态,仅在异常时重启
|
|
588
|
+
if existing_task.exception() is not None:
|
|
589
|
+
logger.info(f"消费者 '{client_name}' 任务异常,重启")
|
|
590
|
+
existing_task.cancel()
|
|
591
|
+
else:
|
|
592
|
+
logger.info(f"消费者 '{client_name}' 已在运行中,无需重复启动")
|
|
593
|
+
return
|
|
594
|
+
else:
|
|
595
|
+
logger.info(f"消费者 '{client_name}' 任务已完成,重新启动")
|
|
593
596
|
|
|
594
597
|
if client_name not in cls._clients:
|
|
595
598
|
raise ValueError(f"RabbitMQ客户端 '{client_name}' 未初始化")
|
|
@@ -804,8 +807,7 @@ class RabbitMQService:
|
|
|
804
807
|
retry_count += 1
|
|
805
808
|
logger.warning(
|
|
806
809
|
f"发送器 '{queue_name}' 第 {retry_count} 次重连失败: {str(e)}")
|
|
807
|
-
|
|
808
|
-
await asyncio.sleep(1)
|
|
810
|
+
await asyncio.sleep(cls.RECONNECT_INTERVAL)
|
|
809
811
|
|
|
810
812
|
if retry_count >= max_retry and not await sender.is_connected:
|
|
811
813
|
error_msg = f"发送器 '{queue_name}' 经过 {max_retry} 次重连仍失败"
|
|
@@ -889,8 +891,6 @@ class RabbitMQService:
|
|
|
889
891
|
task.cancel()
|
|
890
892
|
try:
|
|
891
893
|
await asyncio.wait_for(task, timeout=timeout)
|
|
892
|
-
except asyncio.TimeoutError:
|
|
893
|
-
logger.warning(f"消费者 '{client_name}' 关闭超时")
|
|
894
894
|
except Exception as e:
|
|
895
895
|
logger.error(f"关闭消费者 '{client_name}' 失败: {str(e)}")
|
|
896
896
|
|
sycommon/services.py
CHANGED
|
@@ -71,7 +71,8 @@ class Services(metaclass=SingletonMeta):
|
|
|
71
71
|
app.state.config = {
|
|
72
72
|
"host": cls._config.get('Host', '0.0.0.0'),
|
|
73
73
|
"port": cls._config.get('Port', 8080),
|
|
74
|
-
"workers": cls._config.get('Workers', 1)
|
|
74
|
+
"workers": cls._config.get('Workers', 1),
|
|
75
|
+
"h11_max_incomplete_event_size": cls._config.get('H11MaxIncompleteEventSize', 1024 * 1024 * 1024)
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
# 立即配置非异步服务(在应用启动前)
|
sycommon/synacos/feign.py
CHANGED
|
@@ -97,7 +97,7 @@ async def feign(service_name, api_path, method='GET', params=None, headers=None,
|
|
|
97
97
|
data=data,
|
|
98
98
|
timeout=timeout
|
|
99
99
|
) as response:
|
|
100
|
-
return await _handle_feign_response(response)
|
|
100
|
+
return await _handle_feign_response(response, service_name, api_path)
|
|
101
101
|
else:
|
|
102
102
|
# 普通JSON请求
|
|
103
103
|
async with session.request(
|
|
@@ -108,21 +108,21 @@ async def feign(service_name, api_path, method='GET', params=None, headers=None,
|
|
|
108
108
|
json=body,
|
|
109
109
|
timeout=timeout
|
|
110
110
|
) as response:
|
|
111
|
-
return await _handle_feign_response(response)
|
|
111
|
+
return await _handle_feign_response(response, service_name, api_path)
|
|
112
112
|
except aiohttp.ClientError as e:
|
|
113
113
|
SYLogger.error(
|
|
114
|
-
f"nacos:请求服务接口时出错ClientError path: {api_path} error:{e}")
|
|
114
|
+
f"nacos:请求服务接口时出错ClientError server: {service_name} path: {api_path} error:{e}")
|
|
115
115
|
return None
|
|
116
116
|
except Exception as e:
|
|
117
117
|
import traceback
|
|
118
118
|
SYLogger.error(
|
|
119
|
-
f"nacos:请求服务接口时出错 path: {api_path} error:{traceback.format_exc()}")
|
|
119
|
+
f"nacos:请求服务接口时出错 server: {service_name} path: {api_path} error:{traceback.format_exc()}")
|
|
120
120
|
return None
|
|
121
121
|
finally:
|
|
122
122
|
await session.close()
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
async def _handle_feign_response(response):
|
|
125
|
+
async def _handle_feign_response(response, service_name: str, api_path: str):
|
|
126
126
|
"""
|
|
127
127
|
处理Feign请求的响应,统一返回格式
|
|
128
128
|
调整逻辑:先判断状态码,再处理内容
|
|
@@ -160,9 +160,9 @@ async def _handle_feign_response(response):
|
|
|
160
160
|
response_body = await response.text(encoding='utf-8', errors='ignore')
|
|
161
161
|
except Exception:
|
|
162
162
|
binary_data = await response.read()
|
|
163
|
-
response_body = f"非200状态,响应无法解码:{binary_data[:100].hex()}"
|
|
163
|
+
response_body = f"非200状态,响应无法解码:{binary_data[:100].hex()} server: {service_name} path: {api_path}"
|
|
164
164
|
|
|
165
|
-
error_msg = f"请求失败,状态码: {status_code},响应内容: {str(response_body)[:500]}"
|
|
165
|
+
error_msg = f"请求失败,状态码: {status_code},响应内容: {str(response_body)[:500]} server: {service_name} path: {api_path}"
|
|
166
166
|
SYLogger.error(error_msg)
|
|
167
167
|
return {
|
|
168
168
|
"success": False,
|
|
@@ -174,5 +174,6 @@ async def _handle_feign_response(response):
|
|
|
174
174
|
except Exception as e:
|
|
175
175
|
import traceback
|
|
176
176
|
error_detail = f"处理响应异常: {str(e)}\n{traceback.format_exc()}"
|
|
177
|
-
SYLogger.error(
|
|
177
|
+
SYLogger.error(
|
|
178
|
+
f"nacos:处理响应时出错: {error_detail} server: {service_name} path: {api_path}")
|
|
178
179
|
return None
|
|
@@ -10,7 +10,6 @@ import yaml
|
|
|
10
10
|
import time
|
|
11
11
|
import atexit
|
|
12
12
|
import random
|
|
13
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
14
13
|
|
|
15
14
|
from sycommon.config.Config import SingletonMeta
|
|
16
15
|
from sycommon.logging.kafka_log import SYLogger
|
|
@@ -34,22 +33,17 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
34
33
|
# 添加可重入锁用于状态同步
|
|
35
34
|
self._state_lock = threading.RLock()
|
|
36
35
|
|
|
37
|
-
# 优化线程池配置,增加工作线程数量
|
|
38
|
-
self._executor = ThreadPoolExecutor(max_workers=1) # 主线程池
|
|
39
|
-
self._heartbeat_executor = ThreadPoolExecutor(
|
|
40
|
-
max_workers=1) # 增加心跳线程
|
|
41
|
-
self._monitor_executor = ThreadPoolExecutor(
|
|
42
|
-
max_workers=1) # 增加监控线程
|
|
43
|
-
|
|
44
36
|
# 配置参数
|
|
45
37
|
self.max_retries = self.nacos_config.get('maxRetries', 5)
|
|
46
38
|
self.retry_delay = self.nacos_config.get('retryDelay', 1)
|
|
47
|
-
self.retry_backoff = self.nacos_config.get('retryBackoff', 1.5)
|
|
48
39
|
self.max_retry_delay = self.nacos_config.get('maxRetryDelay', 30)
|
|
40
|
+
# 心跳间隔:优先从配置读取,默认15秒(可通过配置修改)
|
|
49
41
|
self.heartbeat_interval = self.nacos_config.get(
|
|
50
42
|
'heartbeatInterval', 15)
|
|
43
|
+
# 心跳超时:固定设置为10秒(需求指定)
|
|
44
|
+
self.heartbeat_timeout = 15
|
|
51
45
|
self.register_retry_interval = self.nacos_config.get(
|
|
52
|
-
'registerRetryInterval',
|
|
46
|
+
'registerRetryInterval', 15) # 注册重试间隔
|
|
53
47
|
|
|
54
48
|
# 长期重试配置
|
|
55
49
|
self.long_term_retry_delay = self.nacos_config.get(
|
|
@@ -129,8 +123,7 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
129
123
|
self._client_initialized = True
|
|
130
124
|
return True
|
|
131
125
|
except Exception as e:
|
|
132
|
-
delay = min(self.retry_delay
|
|
133
|
-
attempt), self.max_retry_delay)
|
|
126
|
+
delay = min(self.retry_delay, self.max_retry_delay)
|
|
134
127
|
SYLogger.error(
|
|
135
128
|
f"nacos:客户端初始化失败 (尝试 {attempt+1}/{self.max_retries}): {e}")
|
|
136
129
|
time.sleep(delay)
|
|
@@ -193,8 +186,7 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
193
186
|
|
|
194
187
|
except Exception as e:
|
|
195
188
|
attempt += 1
|
|
196
|
-
delay = min(self.retry_delay
|
|
197
|
-
(attempt - 1)), self.max_retry_delay)
|
|
189
|
+
delay = min(self.retry_delay, self.max_retry_delay)
|
|
198
190
|
|
|
199
191
|
SYLogger.error(
|
|
200
192
|
f"nacos:客户端初始化失败 (尝试 {attempt}/{max_attempts}): {e}")
|
|
@@ -342,8 +334,7 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
342
334
|
except Exception as e:
|
|
343
335
|
last_error = str(e)
|
|
344
336
|
retry_count += 1
|
|
345
|
-
delay = min(self.register_retry_interval
|
|
346
|
-
(self.retry_backoff ** (retry_count - 1)), self.max_retry_delay)
|
|
337
|
+
delay = min(self.register_retry_interval, self.max_retry_delay)
|
|
347
338
|
|
|
348
339
|
SYLogger.warning(
|
|
349
340
|
f"nacos:服务注册尝试 {retry_count} 失败: {last_error},{delay}秒后重试")
|
|
@@ -429,8 +420,13 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
429
420
|
timeout = 60 # 60秒超时
|
|
430
421
|
start_time = time.time()
|
|
431
422
|
|
|
432
|
-
#
|
|
433
|
-
|
|
423
|
+
# 启动注册线程,不阻塞主线程(替换原线程池)
|
|
424
|
+
register_thread = threading.Thread(
|
|
425
|
+
target=instance.register_with_retry,
|
|
426
|
+
daemon=True,
|
|
427
|
+
name="NacosRegisterThread"
|
|
428
|
+
)
|
|
429
|
+
register_thread.start()
|
|
434
430
|
|
|
435
431
|
# 等待注册完成或超时
|
|
436
432
|
while True:
|
|
@@ -461,7 +457,7 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
461
457
|
|
|
462
458
|
# 启动连接监控线程
|
|
463
459
|
threading.Thread(target=instance.monitor_connection,
|
|
464
|
-
daemon=True).start()
|
|
460
|
+
daemon=True, name="NacosConnectionMonitorThread").start()
|
|
465
461
|
else:
|
|
466
462
|
SYLogger.info("nacos:本地开发模式,跳过服务注册流程")
|
|
467
463
|
|
|
@@ -485,7 +481,11 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
485
481
|
)
|
|
486
482
|
self._heartbeat_thread.daemon = True
|
|
487
483
|
self._heartbeat_thread.start()
|
|
488
|
-
SYLogger.info(
|
|
484
|
+
SYLogger.info(
|
|
485
|
+
f"nacos:心跳线程启动,线程ID: {self._heartbeat_thread.ident},"
|
|
486
|
+
f"心跳间隔: {self.heartbeat_interval}秒,"
|
|
487
|
+
f"心跳超时: {self.heartbeat_timeout}秒"
|
|
488
|
+
)
|
|
489
489
|
|
|
490
490
|
def _send_heartbeat_loop(self):
|
|
491
491
|
"""优化后的心跳发送循环,确保严格按间隔执行"""
|
|
@@ -493,7 +493,8 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
493
493
|
thread_ident = current_thread.ident
|
|
494
494
|
SYLogger.info(
|
|
495
495
|
f"nacos:心跳循环启动 - 线程ID: {thread_ident}, "
|
|
496
|
-
f"配置间隔: {self.heartbeat_interval}
|
|
496
|
+
f"配置间隔: {self.heartbeat_interval}秒, "
|
|
497
|
+
f"超时时间: {self.heartbeat_timeout}秒"
|
|
497
498
|
)
|
|
498
499
|
|
|
499
500
|
consecutive_fail = 0 # 连续失败计数器
|
|
@@ -512,7 +513,7 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
512
513
|
f"nacos:服务未注册,跳过心跳 - 线程ID: {thread_ident}")
|
|
513
514
|
consecutive_fail = 0
|
|
514
515
|
else:
|
|
515
|
-
#
|
|
516
|
+
# 发送心跳(10秒超时)
|
|
516
517
|
success = self.send_heartbeat()
|
|
517
518
|
if success:
|
|
518
519
|
consecutive_fail = 0
|
|
@@ -545,26 +546,46 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
545
546
|
SYLogger.info(f"nacos:心跳循环已停止 - 线程ID: {thread_ident}")
|
|
546
547
|
|
|
547
548
|
def send_heartbeat(self):
|
|
548
|
-
"""
|
|
549
|
+
"""发送心跳并添加10秒超时控制(替换线程池实现)"""
|
|
549
550
|
if not self.ensure_client_connected():
|
|
550
551
|
SYLogger.warning("nacos:客户端未连接,心跳发送失败")
|
|
551
552
|
return False
|
|
552
553
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
554
|
+
# 用线程+join实现10秒超时控制
|
|
555
|
+
result_list = [] # 用于线程间传递结果
|
|
556
|
+
|
|
557
|
+
def heartbeat_task():
|
|
558
|
+
"""心跳实际执行任务"""
|
|
559
|
+
try:
|
|
560
|
+
result = self._send_heartbeat_internal()
|
|
561
|
+
result_list.append(result)
|
|
562
|
+
except Exception as e:
|
|
563
|
+
SYLogger.error(f"nacos:心跳任务执行异常: {e}")
|
|
564
|
+
result_list.append(False)
|
|
565
|
+
|
|
566
|
+
# 启动心跳任务线程
|
|
567
|
+
task_thread = threading.Thread(
|
|
568
|
+
target=heartbeat_task,
|
|
569
|
+
daemon=True,
|
|
570
|
+
name="NacosHeartbeatTaskThread"
|
|
571
|
+
)
|
|
572
|
+
task_thread.start()
|
|
573
|
+
|
|
574
|
+
# 等待线程完成,最多等待10秒
|
|
575
|
+
task_thread.join(timeout=self.heartbeat_timeout)
|
|
576
|
+
|
|
577
|
+
# 处理结果
|
|
578
|
+
if not result_list:
|
|
579
|
+
# 超时未返回
|
|
580
|
+
SYLogger.error(f"nacos:心跳发送超时({self.heartbeat_timeout}秒)")
|
|
565
581
|
self._client_initialized = False # 强制重连
|
|
566
582
|
return False
|
|
567
583
|
|
|
584
|
+
# 检查心跳结果
|
|
585
|
+
if result_list[0]:
|
|
586
|
+
self._last_successful_heartbeat = time.time()
|
|
587
|
+
return result_list[0]
|
|
588
|
+
|
|
568
589
|
def _send_heartbeat_internal(self):
|
|
569
590
|
"""实际的心跳发送逻辑"""
|
|
570
591
|
result = self.nacos_client.send_heartbeat(
|
|
@@ -620,9 +641,13 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
620
641
|
else:
|
|
621
642
|
self.registered = False
|
|
622
643
|
SYLogger.warning(f"nacos:服务实例未注册,尝试重新注册")
|
|
623
|
-
#
|
|
624
|
-
|
|
625
|
-
self.register_with_retry
|
|
644
|
+
# 启动临时线程执行重新注册(替换原线程池)
|
|
645
|
+
retry_thread = threading.Thread(
|
|
646
|
+
target=self.register_with_retry,
|
|
647
|
+
daemon=True,
|
|
648
|
+
name="NacosRetryRegisterThread"
|
|
649
|
+
)
|
|
650
|
+
retry_thread.start()
|
|
626
651
|
|
|
627
652
|
# 20%的概率执行深度检查
|
|
628
653
|
if random.random() < 0.2:
|
|
@@ -673,13 +698,6 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
673
698
|
SYLogger.error(f"nacos:注销服务时发生错误: {e}")
|
|
674
699
|
finally:
|
|
675
700
|
self._shutdown_event.set()
|
|
676
|
-
# 优雅地关闭线程池
|
|
677
|
-
if self._executor and not self._executor._shutdown:
|
|
678
|
-
self._executor.shutdown(wait=True)
|
|
679
|
-
if self._heartbeat_executor and not self._heartbeat_executor._shutdown:
|
|
680
|
-
self._heartbeat_executor.shutdown(wait=True)
|
|
681
|
-
if self._monitor_executor and not self._monitor_executor._shutdown:
|
|
682
|
-
self._monitor_executor.shutdown(wait=True)
|
|
683
701
|
|
|
684
702
|
def handle_signal(self, signum, frame):
|
|
685
703
|
"""处理退出信号"""
|
|
@@ -751,7 +769,8 @@ class NacosService(metaclass=SingletonMeta):
|
|
|
751
769
|
for data_id, callback in list(self._config_listeners.items()):
|
|
752
770
|
new_config = self.get_config(data_id)
|
|
753
771
|
if new_config and new_config != self._config_cache.get(data_id):
|
|
754
|
-
|
|
772
|
+
# 直接执行回调(替换原线程池,配置回调通常为轻量操作)
|
|
773
|
+
callback(new_config)
|
|
755
774
|
self._config_cache[data_id] = new_config
|
|
756
775
|
except Exception as e:
|
|
757
776
|
SYLogger.error(f"nacos:配置监视线程异常: {str(e)}")
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sycommon-python-lib
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.44
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: aio-pika>=9.5.
|
|
8
|
-
Requires-Dist: aiohttp>=3.13.
|
|
7
|
+
Requires-Dist: aio-pika>=9.5.8
|
|
8
|
+
Requires-Dist: aiohttp>=3.13.2
|
|
9
9
|
Requires-Dist: decorator>=5.2.1
|
|
10
|
-
Requires-Dist: fastapi>=0.
|
|
11
|
-
Requires-Dist: kafka-python>=2.2.
|
|
10
|
+
Requires-Dist: fastapi>=0.121.2
|
|
11
|
+
Requires-Dist: kafka-python>=2.2.16
|
|
12
12
|
Requires-Dist: loguru>=0.7.3
|
|
13
13
|
Requires-Dist: mysql-connector-python>=9.5.0
|
|
14
14
|
Requires-Dist: nacos-sdk-python>=2.0.9
|
|
15
|
-
Requires-Dist: pydantic>=2.12.
|
|
15
|
+
Requires-Dist: pydantic>=2.12.4
|
|
16
16
|
Requires-Dist: python-dotenv>=1.2.1
|
|
17
17
|
Requires-Dist: pyyaml>=6.0.3
|
|
18
18
|
Requires-Dist: sqlalchemy>=2.0.44
|
|
19
|
-
Requires-Dist: starlette>=0.
|
|
19
|
+
Requires-Dist: starlette>=0.49.3
|
|
20
20
|
Requires-Dist: uuid>=1.30
|
|
21
21
|
Requires-Dist: uvicorn>=0.38.0
|
|
22
22
|
|
|
@@ -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=LHMRxxRvLAiekkVspaQClBgAR_jLKqiJpd5hqF74MIE,11369
|
|
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
|
|
@@ -27,7 +27,7 @@ sycommon/middleware/middleware.py,sha256=SzZ4wufSNdwC4Ppw99TE7a6AVGkrZRc55NHSrA3
|
|
|
27
27
|
sycommon/middleware/monitor_memory.py,sha256=pYRK-wRuDd6enSg9Pf8tQxPdYQS6S0AyjyXeKFRLKEs,628
|
|
28
28
|
sycommon/middleware/mq.py,sha256=4wBqiT5wJGcrfjk2GSr0_U3TStBxoNpHTzcRxVlMEHE,183
|
|
29
29
|
sycommon/middleware/timeout.py,sha256=fImlAPLm4Oa8N9goXtT_0os1GZPCi9F92OgXU81DgDU,656
|
|
30
|
-
sycommon/middleware/traceid.py,sha256=
|
|
30
|
+
sycommon/middleware/traceid.py,sha256=ugqPgHdUydj7m481rM_RH-yrIK9hAdkLemdPSSOnQvw,6821
|
|
31
31
|
sycommon/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
sycommon/models/base_http.py,sha256=EICAAibx3xhjBsLqm35Mi3DCqxp0FME4rD_3iQVjT_E,3051
|
|
33
33
|
sycommon/models/log.py,sha256=rZpj6VkDRxK3B6H7XSeWdYZshU8F0Sks8bq1p6pPlDw,500
|
|
@@ -35,25 +35,25 @@ 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=
|
|
39
|
-
sycommon/rabbitmq/rabbitmq_pool.py,sha256=
|
|
40
|
-
sycommon/rabbitmq/rabbitmq_service.py,sha256=
|
|
38
|
+
sycommon/rabbitmq/rabbitmq_client.py,sha256=aRS7sYN4RAJ210Bl-Bh0qR7mXpaag_5YygNXz6ryhtQ,19677
|
|
39
|
+
sycommon/rabbitmq/rabbitmq_pool.py,sha256=ckHEpvPXS4TdHRS_2eGyiQ7kej3P7Wnyk3nttAjk04o,17724
|
|
40
|
+
sycommon/rabbitmq/rabbitmq_service.py,sha256=L7SKf8Ws2wZvF0YGU1ZUiqg3z_viSNmMR0Zz4_5jBSY,39775
|
|
41
41
|
sycommon/sse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
sycommon/sse/event.py,sha256=k_rBJy23R7crtzQeetT0Q73D8o5-5p-eESGSs_BPOj0,2797
|
|
43
43
|
sycommon/sse/sse.py,sha256=__CfWEcYxOxQ-HpLor4LTZ5hLWqw9-2X7CngqbVHsfw,10128
|
|
44
44
|
sycommon/synacos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
sycommon/synacos/example.py,sha256=61XL03tU8WTNOo3FUduf93F2fAwah1S0lbH1ufhRhRk,5739
|
|
46
46
|
sycommon/synacos/example2.py,sha256=adUaru3Hy482KrOA17DfaC4nwvLj8etIDS_KrWLWmCU,4811
|
|
47
|
-
sycommon/synacos/feign.py,sha256
|
|
47
|
+
sycommon/synacos/feign.py,sha256=-2tuGCqoSM3ddSoSz7h1RJTB06hn8K26v_1ev4qLsTU,7728
|
|
48
48
|
sycommon/synacos/feign_client.py,sha256=JxzxohrsscQNlAjRVo_3ZQrMQSfVHFOtRYyEnP6sDGk,15205
|
|
49
|
-
sycommon/synacos/nacos_service.py,sha256=
|
|
49
|
+
sycommon/synacos/nacos_service.py,sha256=Hxd3fQOR53iujUjCboJoQum5vAXxQ9sdc8YlDug1OF0,35092
|
|
50
50
|
sycommon/synacos/param.py,sha256=KcfSkxnXOa0TGmCjY8hdzU9pzUsA8-4PeyBKWI2-568,1765
|
|
51
51
|
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.44.dist-info/METADATA,sha256=e_42ggxA1f4lcE0zFt2uvEPbT_Q5pANx_Dpb6HFIrVQ,7037
|
|
56
|
+
sycommon_python_lib-0.1.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
57
|
+
sycommon_python_lib-0.1.44.dist-info/entry_points.txt,sha256=q_h2nbvhhmdnsOUZEIwpuoDjaNfBF9XqppDEmQn9d_A,46
|
|
58
|
+
sycommon_python_lib-0.1.44.dist-info/top_level.txt,sha256=98CJ-cyM2WIKxLz-Pf0AitWLhJyrfXvyY8slwjTXNuc,17
|
|
59
|
+
sycommon_python_lib-0.1.44.dist-info/RECORD,,
|
|
File without changes
|
{sycommon_python_lib-0.1.42.dist-info → sycommon_python_lib-0.1.44.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|