fix(douyu): 补全账号能力目录并回收失效租约
This commit is contained in:
@@ -461,6 +461,10 @@
|
||||
"20261122_0115_account_commodity_eligibility_split.py": {
|
||||
"revision": "20261122_0115",
|
||||
"sha256": "a66dba263e6b2e9b10b2bd52316ef630890b470a3c2b08f8ab0a07ef0521d0fa"
|
||||
},
|
||||
"20261122_0116_enable_fulfillment_lease_reaper.py": {
|
||||
"revision": "20261122_0116",
|
||||
"sha256": "e756ffc9e953fc1b6167376eff830f1441194636626587808e2a2746a9b16fce"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
"""enable fulfillment lease reaper and demand refresh cadence.
|
||||
|
||||
Revision ID: 20261122_0116
|
||||
Revises: 20261122_0115
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "20261122_0116"
|
||||
down_revision: str | None = "20261122_0115"
|
||||
branch_labels: str | None = None
|
||||
depends_on: str | None = None
|
||||
|
||||
REAPER_KEY = "platform_fulfillment_lease_reaper"
|
||||
CAPABILITY_REFRESH_KEY = "account_capability_refresh"
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""激活安全回收,并让需求补货跟随独立同步槽的分钟级节奏。
|
||||
|
||||
历史上两个作业虽然已注册,但生产行一直保持禁用/5 分钟间隔,导致
|
||||
扫码超时任务无限占号和商品能力补货长期滞后。
|
||||
"""
|
||||
if not sa.inspect(op.get_bind()).has_table("automation_jobs"):
|
||||
return
|
||||
op.execute(
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE automation_jobs
|
||||
SET enabled = 1,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE `key` = :key
|
||||
"""
|
||||
).bindparams(key=REAPER_KEY)
|
||||
)
|
||||
op.execute(
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE automation_jobs
|
||||
SET run_interval_seconds = 60,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE `key` = :key
|
||||
AND run_interval_seconds = 300
|
||||
"""
|
||||
).bindparams(key=CAPABILITY_REFRESH_KEY)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""不恢复禁用状态;回滚代码后仍应保留安全回收作业配置。"""
|
||||
return
|
||||
Reference in New Issue
Block a user