feat(shipping-notice): 新增库存确认来源接口及相关逻辑
This commit is contained in:
1 parent
a31735b689
commit
0a9bd6415d
69 files changed
+8442
-775
No files matched your search
@@ -110,14 +110,27 @@ def _requeue_external_wait_job(task_no: str, *, job: Job | None = None) -> None:
|
||||
|
||||
|
||||
def recover_stale_shipping_notice_jobs() -> tuple[int, str]:
|
||||
"""兼容旧调用:回收通用 jobs 表里超时的发货任务。"""
|
||||
"""兼容旧调用:回收通用 jobs 表里超时的发货任务,并顺带消费 RPA callback cleanup 队列。"""
|
||||
from app.jobs.queue import recover_stale_jobs
|
||||
from app.services.shipping_notice.inventory_rpa_callback_cleanup import (
|
||||
recover_pending_rpa_callback_cleanup_jobs,
|
||||
)
|
||||
|
||||
timeout_sec = float(current_app.config.get('SHIPPING_NOTICE_JOB_RUNNING_TIMEOUT_SECONDS', 300))
|
||||
count = recover_stale_jobs(domain=SHIPPING_NOTICE_JOB_DOMAIN, timeout_seconds=timeout_sec)
|
||||
cleanup_count, cleanup_warnings = recover_pending_rpa_callback_cleanup_jobs()
|
||||
if cleanup_warnings:
|
||||
logger.warning('rpa callback cleanup warnings: %s', '; '.join(cleanup_warnings[:5]))
|
||||
if count:
|
||||
logger.warning('recovered %s stale shipping_notice job(s)', count)
|
||||
return count, f'recovered_{count}' if count else 'no_stale_jobs'
|
||||
if cleanup_count:
|
||||
logger.info('processed %s rpa callback cleanup job(s)', cleanup_count)
|
||||
parts = []
|
||||
if count:
|
||||
parts.append(f'recovered_{count}')
|
||||
if cleanup_count:
|
||||
parts.append(f'callback_cleanup_{cleanup_count}')
|
||||
return count, '_'.join(parts) if parts else 'no_stale_jobs'
|
||||
|
||||
|
||||
def claim_next_shipping_notice_job() -> Job | None:
|
||||
|
||||
Reference in new issue
Block a user