docs(analytics): tick docstring锁竞争与时区措辞修正+测试名对齐4job
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -677,12 +677,14 @@ class SyncScheduler:
|
||||
"""4h 分析链(stat_daily_staff 滚动3天 + 敏感词增量)——异常只记日志不断链。
|
||||
|
||||
纯 DB 无浏览器子进程,不抢 ``_page_lock``(DB 写毫秒级;
|
||||
``max_instances=1`` 防自身重叠即可;与夜间 full_sync 的
|
||||
staff-daily-stats 步骤重叠时 UNIQUE 兜底幂等)。
|
||||
``max_instances=1`` 防自身重叠即可)。与夜间 full_sync 的
|
||||
staff-daily-stats 步骤重叠时,两侧 DELETE+INSERT 在重叠 PK 范围上
|
||||
可能死锁/锁等待——非致命:tick 吞异常下轮重试,夜间脚本无 set -e
|
||||
次日自愈(UNIQUE/PK 幂等只保证串行提交下不重复,不消锁竞争)。
|
||||
|
||||
时区:today 用 ``time.time()``(UTC epoch,无时区歧义)喂
|
||||
``day_key``——naive ``now().timestamp()`` 按本地时区解释,服务器
|
||||
时区未必是上海(2026-09-04 部署注意点)。
|
||||
时区:``day_key`` 内部钉死 Asia/Shanghai,喂 UTC epoch
|
||||
(``time.time()*1000``)即无歧义——用 epoch 而非 naive datetime
|
||||
只为读法直接,数学上两者经本地时区往返等价。
|
||||
"""
|
||||
try:
|
||||
async with self._session_maker() as session:
|
||||
|
||||
@@ -401,7 +401,7 @@ async def test_run_once_proceeds_after_stale_run_expires(monkeypatch):
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def test_start_registers_two_jobs_with_expected_triggers(engine, session_maker):
|
||||
async def test_start_registers_all_jobs_with_expected_triggers(engine, session_maker):
|
||||
"""start() wires a daily CronTrigger (full) + an IntervalTrigger (messages)."""
|
||||
sched = SyncScheduler(
|
||||
full_sync_hour=3,
|
||||
|
||||
Reference in New Issue
Block a user