Skip to main content

Execution & Retries

What happens each time a job fires: the execution record it leaves behind, how failures are retried, and when a job is paused for you.

Execution History

Every firing is recorded as an execution. Query the history to debug failures or monitor delivery.

curl -X POST https://api.travila.ai/api/v1/scheduler/list-executions \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"scheduleId": "sched_a1b2c3d4e5f60718",
"pageSize": 20,
"statusFilter": "EXECUTION_STATUS_FAILED"
}'

Execution records include:

FieldDescription
statusEXECUTION_STATUS_SUCCESS, EXECUTION_STATUS_FAILED, EXECUTION_STATUS_MALFORMED, EXECUTION_STATUS_DISCARDED (retries exhausted), or EXECUTION_STATUS_CANCELLED (operator cancellation)
httpStatusHTTP status code returned by the target
attemptAttempt number (1-based) within this firing
durationMsEnd-to-end duration of the delivery attempt
errorError message on FAILED or MALFORMED outcomes
scheduledTimeWhen the execution was supposed to fire
startedAt / completedAtActual start and completion times
responseBodyTruncated HTTP response body captured on failed dispatches (4 KiB cap). Empty for successful dispatches.
responseHeadersAllowlisted response headers from the failed dispatch: content-type, content-length, retry-after, x-request-id, date.
responseTruncatedtrue when responseBody was clipped at the 4 KiB cap.
responseSizeBytesOriginal response size in bytes (from Content-Length when present, else total bytes read before truncation).

Retry Policy

Each firing retries independently with exponential backoff until it succeeds or exhausts maxAttempts.

FieldDefaultDescription
maxAttempts10Total delivery attempts including the initial one
initialBackoffMs5000Backoff before the first retry (5 seconds)
maxBackoffMs1800000Maximum backoff cap (30 minutes)

To override the defaults, include a retryPolicy in your create-job request:

curl -X POST https://api.travila.ai/api/v1/scheduler/create-job \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"name": "Critical alert",
"scheduleType": "SCHEDULE_TYPE_CRON",
"cronExpression": "*/5 * * * *",
"target": {
"url": "https://your-api.example.com/jobs/alert",
"kind": "alert"
},
"retryPolicy": {
"maxAttempts": 3,
"initialBackoffMs": 1000,
"maxBackoffMs": 10000
}
}'

Auto-Pause

A job is automatically paused when it accumulates N consecutive failures. This prevents a broken target from accumulating unbounded retry debt.

  • Default threshold: 10 consecutive failures (applied when autoPauseThreshold is omitted or set to 0)
  • Valid override range: 3–100
  • When auto-paused, the job state becomes SCHEDULE_STATE_PAUSED and pausedReason records the cause

Resume the job with resume-job once the target is healthy.