aury-boot 0.0.38__py3-none-any.whl → 0.0.39__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 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.38'
32
- __version_tuple__ = version_tuple = (0, 0, 38)
31
+ __version__ = version = '0.0.39'
32
+ __version_tuple__ = version_tuple = (0, 0, 39)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -102,6 +102,18 @@ load_all_models(_model_modules)
102
102
  target_metadata = Base.metadata
103
103
 
104
104
 
105
+ # === 兼容性处理 ===
106
+ # 过滤 PostgreSQL 15+ 特有的约束参数,确保生成的 migration 兼容旧版本 PG
107
+ _PG15_CONSTRAINT_KWARGS = {{"postgresql_nulls_not_distinct", "postgresql_include"}}
108
+
109
+ def _render_item(type_, obj, autogen_context):
110
+ """自定义渲染,过滤不兼容的约束参数。"""
111
+ if type_ == "unique_constraint" and hasattr(obj, "kwargs"):
112
+ for key in _PG15_CONSTRAINT_KWARGS:
113
+ obj.kwargs.pop(key, None)
114
+ return False # 使用默认渲染
115
+
116
+
105
117
  def get_url() -> str:
106
118
  """获取数据库 URL(优先环境变量,其次 alembic.ini)。"""
107
119
  return os.environ.get("DATABASE_URL") or config.get_main_option("sqlalchemy.url", "")
@@ -117,8 +129,8 @@ def run_migrations_offline() -> None:
117
129
  dialect_opts={{"paramstyle": "named"}},
118
130
  compare_type=True,
119
131
  compare_server_default=True,
120
- # 启用 batch 模式以更好地支持 SQLite 等不完整 DDL 的后端
121
132
  render_as_batch=True,
133
+ render_item=_render_item,
122
134
  )
123
135
  with context.begin_transaction():
124
136
  context.run_migrations()
@@ -131,8 +143,8 @@ def _do_run_migrations(connection) -> None:
131
143
  target_metadata=target_metadata,
132
144
  compare_type=True,
133
145
  compare_server_default=True,
134
- # 启用 batch 模式以更好地支持 SQLite 等不完整 DDL 的后端
135
146
  render_as_batch=True,
147
+ render_item=_render_item,
136
148
  )
137
149
  with context.begin_transaction():
138
150
  context.run_migrations()
@@ -65,6 +65,10 @@ class RedisStreamMQ(IMQ):
65
65
  self._max_len = max_len
66
66
  self._consuming = False
67
67
  self._owns_client = False
68
+ self._log_sample_counter = 0 # 日志采样计数器
69
+
70
+ # 日志采样率:每 N 个 send 打印 1 次
71
+ LOG_SAMPLE_RATE = 100
68
72
 
69
73
  async def _ensure_client(self) -> None:
70
74
  """确保 Redis 客户端已初始化。"""
@@ -122,7 +126,10 @@ class RedisStreamMQ(IMQ):
122
126
  else:
123
127
  msg_id = await self._client.connection.xadd(stream_key, data)
124
128
 
125
- logger.debug(f"发送消息到 Stream: {stream_key}, id={msg_id}")
129
+ # 采样日志:每 N 个消息打印 1 次
130
+ self._log_sample_counter += 1
131
+ if self._log_sample_counter % self.LOG_SAMPLE_RATE == 1:
132
+ logger.debug(f"发送消息到 Stream: {stream_key}, id={msg_id}, count={self._log_sample_counter}")
126
133
  return message.id
127
134
 
128
135
  async def receive(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aury-boot
3
- Version: 0.0.38
3
+ Version: 0.0.39
4
4
  Summary: Aury Boot - 基于 FastAPI 生态的企业级 API 开发框架
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: alembic>=1.17.2
@@ -1,5 +1,5 @@
1
1
  aury/boot/__init__.py,sha256=pCno-EInnpIBa1OtxNYF-JWf9j95Cd2h6vmu0xqa_-4,1791
2
- aury/boot/_version.py,sha256=vz5IG1ZbpfA63zA7xZI2HHU8kmL9ekzBS0BXtKYIdco,706
2
+ aury/boot/_version.py,sha256=4ZEdlNp6MHArYK_GfVRp7IC9mBDzzgBih3DH2hlHeCo,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
@@ -32,7 +32,7 @@ aury/boot/application/middleware/__init__.py,sha256=T01fmbcdO0Sm6JE74g23uuDyebBG
32
32
  aury/boot/application/middleware/logging.py,sha256=kStfLskA_srNvWIuNMs0ptZ4Wr9-ke6hYl8kESxbhxc,13509
33
33
  aury/boot/application/migrations/__init__.py,sha256=Z5Gizx7f3AImRcl3cooiIDAZcNi5W-6GvB7mK5w1TNA,204
34
34
  aury/boot/application/migrations/manager.py,sha256=G7mzkNA3MFjyQmM2UwY0ZFNgGGVS4W5GoG2Sbj5AUXk,23685
35
- aury/boot/application/migrations/setup.py,sha256=cxzBIHGzRXhlIYs4_ZW6P85Z9A7uVnTq_dmQFKp3ha4,6485
35
+ aury/boot/application/migrations/setup.py,sha256=mA7q8JEkVVDW55PdSE6KUhhmDNMMWmbQxqfwOts4vIw,6889
36
36
  aury/boot/application/rpc/__init__.py,sha256=0mVyksLbTOLYMN4OtYrdf9naBNVQnAU9pt2kS2w_9ZY,2064
37
37
  aury/boot/application/rpc/base.py,sha256=KqdWupF2PTizr--jE0KgJUDCfBap72ZWk9FtU5FM9_8,2618
38
38
  aury/boot/application/rpc/client.py,sha256=ApW4h_DrwnnkAh921TVUd4fvdWP-rVIse3VW1_1TLPk,9113
@@ -193,7 +193,7 @@ aury/boot/infrastructure/mq/manager.py,sha256=Bu4E1Tgz0CzFvJuCS9_fBMj9eAqmXcZp8a
193
193
  aury/boot/infrastructure/mq/backends/__init__.py,sha256=10nggw2V-AzuZ1vvzq_ksoXR4FI3e4BR36EfY49Pek4,200
194
194
  aury/boot/infrastructure/mq/backends/rabbitmq.py,sha256=0NWgPKEwtbmI63EVvKINdfXXDNyOvuOOP9LlBzqH91E,5493
195
195
  aury/boot/infrastructure/mq/backends/redis.py,sha256=B89U7mqIceUsCXE4G3u1u6aFM9hv4mmLLwuCYq1T9tQ,5281
196
- aury/boot/infrastructure/mq/backends/redis_stream.py,sha256=-ZMW4RuQdpmH3hBIqRP7ROyW1gbt8bZ1ZSTrTOynXQQ,14422
196
+ aury/boot/infrastructure/mq/backends/redis_stream.py,sha256=p2WTj10-zbxQ_2NPU97w-n4DZ8KSHhLjqcnplLPCw4U,14761
197
197
  aury/boot/infrastructure/scheduler/__init__.py,sha256=eTRJ5dSPcKvyFvLVtraoQteXTTDDGwIrmw06J2hoNdA,323
198
198
  aury/boot/infrastructure/scheduler/exceptions.py,sha256=ROltrhSctVWA-6ulnjuYeHAk3ZF-sykDoesuierYzew,634
199
199
  aury/boot/infrastructure/scheduler/manager.py,sha256=OHQOHQlcoN8yFnky4kfuhsEIk39qX6nLZ7xJ51tfg68,23130
@@ -212,7 +212,7 @@ aury/boot/testing/client.py,sha256=KOg1EemuIVsBG68G5y0DjSxZGcIQVdWQ4ASaHE3o1R0,4
212
212
  aury/boot/testing/factory.py,sha256=8GvwX9qIDu0L65gzJMlrWB0xbmJ-7zPHuwk3eECULcg,5185
213
213
  aury/boot/toolkit/__init__.py,sha256=AcyVb9fDf3CaEmJPNkWC4iGv32qCPyk4BuFKSuNiJRQ,334
214
214
  aury/boot/toolkit/http/__init__.py,sha256=zIPmpIZ9Qbqe25VmEr7jixoY2fkRbLm7NkCB9vKpg6I,11039
215
- aury_boot-0.0.38.dist-info/METADATA,sha256=jv4ryFTmPLz8qul4nDVB1ju3ftR7oatLmwexC68sM1w,8694
216
- aury_boot-0.0.38.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
217
- aury_boot-0.0.38.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
218
- aury_boot-0.0.38.dist-info/RECORD,,
215
+ aury_boot-0.0.39.dist-info/METADATA,sha256=qX6IZza7loT9gQzeJlbhPz1QKshBy3fZH__Fic8U1s0,8694
216
+ aury_boot-0.0.39.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
217
+ aury_boot-0.0.39.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
218
+ aury_boot-0.0.39.dist-info/RECORD,,