feat(shipping-notice): 新增发货通知重复检测与处理接口,支持重复决策保存与重新执行检测

This commit is contained in:
hugo committed 2026-07-14 21:12:36 +08:00
1 parent 729546a7b7
commit ceb49461e8
72 files changed
+14270 -460

No files matched your search

+12 -2
View File
@@ -43,13 +43,23 @@ def run_forever(ctx: JobContext, *, poll_interval_seconds: float | None = None)
continue
handler = get_handler(job['job_type'])
owned_attempt = job.get('attempts')
owned_attempt_int = int(owned_attempt) if owned_attempt is not None else None
if not handler:
ctx.logger.error('No handler for job_type=%s job_id=%s', job.get('job_type'), job.get('id'))
store.mark_failed(job['id'], message=f'no handler for {job.get("job_type")}')
store.mark_failed(
job['id'],
message=f'no handler for {job.get("job_type")}',
owned_attempt=owned_attempt_int,
)
continue
try:
handler(ctx, job.get('payload') or {})
except Exception as exc:
ctx.logger.exception('Handler failed job_id=%s', job.get('id'))
store.mark_failed(job['id'], message=str(exc))
store.mark_failed(
job['id'],
message=str(exc),
owned_attempt=owned_attempt_int,
)