chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑
This commit is contained in:
1 parent
5ef8329bd8
commit
4ec4e57005
183 files changed
+14653
-3936
No files matched your search
@@ -25,6 +25,7 @@ from app.services.shipping_notice.process_gate_job_service import (
|
||||
SHIPPING_PROCESS_GATE_JOB_DOMAIN,
|
||||
claim_and_run_gate_attempt,
|
||||
enqueue_gate_attempt_job,
|
||||
schedule_waiting_external_poll,
|
||||
)
|
||||
from app.services.shipping_notice.process_gate_service import complete_gate_attempt
|
||||
|
||||
@@ -127,4 +128,11 @@ def run_shipping_process_gate(ctx: JobContext, payload: dict) -> None:
|
||||
fail_job(job.id, error=safe_error, retryable=False, owned_attempt=owned_attempt)
|
||||
return
|
||||
|
||||
finish_job(job.id, result=result if isinstance(result, dict) else {'status': 'ok'}, owned_attempt=owned_attempt)
|
||||
# [STEP] 外部等待不是终态:Attempt 已正常执行完且 Gate 明确等待外部系统时,
|
||||
# 必须在当前 Job 成功收口后创建新的延迟 poll Attempt。此前只结束 Job,造成
|
||||
# Gate 永久停在 waiting_external,批次中心持续显示“处理中”。
|
||||
result_payload = result if isinstance(result, dict) else {'status': 'ok'}
|
||||
finish_job(job.id, result=result_payload, owned_attempt=owned_attempt)
|
||||
if str(result_payload.get('gate_status') or '').strip().lower() == 'waiting_external':
|
||||
schedule_waiting_external_poll(attempt_id=attempt_id)
|
||||
db.session.commit()
|
||||
Reference in new issue
Block a user