IM
ZH-TW
文件首頁
選單
指南

作業重試和解決方案

明確操作非同步作業並確定性地處理故障狀態。

inbox-manager client-flow

作業重試和解決方案

目的:明確操作非同步作業並確定性地處理故障狀態。

使用者介面流程

  1. UI 顯示每個帳戶的佇列和任務狀態。
  2. 使用者在失敗或卡住時開啟作業詳細資料。
  3. UI 允許TriggerRetryResolve
  4. UI 反白顯示last_error_codelast_error_detail
  5. UI 在作業操作後刷新任務狀態。

客戶端庫流程

const jobs = await api.jobs.list(accountId, { limit: 50 });
const failed = jobs.data.filter((row) => row.failed_at);
for (const job of failed) {
  await api.jobs.retry(job.id);
}
const inFlight = await api.jobs.list(accountId, {
  q: "imap_sync_messages",
  limit: 20,
});

HTTP/curl 流程

API_BASE_URL="https://api.inbox-manager.com"

curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/jobs?limit=20&offset=0" \
  -H "authorization: Bearer ${BEARER_TOKEN}"

curl -sS -X POST "${API_BASE_URL}/api/jobs/${JOB_ID}/trigger" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data '{}'

curl -sS -X POST "${API_BASE_URL}/api/jobs/${JOB_ID}/retry" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data '{}'

curl -sS -X POST "${API_BASE_URL}/api/jobs/${JOB_ID}/resolve" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data '{"note":"handled after provider maintenance window"}'

錯誤分類方向

  • 工作人員現在記錄分類last_error_code值:
    • 瞬時連接
    • 身份驗證
    • 授權
    • 配置
    • 有效負載驗證
    • 未找到