Skip to main content
SnackBase includes a background job engine that powers reliable asynchronous execution for webhooks, scheduled hooks, workflow delays, and email delivery. Jobs are managed by superadmins through the Admin API.

Overview

The job system is the execution substrate that other automation features build on:
  • Webhook deliveries are dispatched as jobs with automatic retries
  • Scheduled hooks are executed via jobs on their cron schedule
  • Workflow delays (wait_delay steps) enqueue resume jobs
  • Email sending is handled by background jobs

Key Features

  • Priority Queue: Jobs execute in priority order (lower number = higher priority)
  • Automatic Retries: Failed jobs retry with exponential backoff
  • Stale Job Recovery: Jobs stuck in running state are automatically recovered
  • Job Statistics: Aggregate counts by status with failure rate
  • Retention Cleanup: Completed jobs are automatically purged after a configurable period

Job Lifecycle

Job Statuses

Retry Logic

Failed jobs retry automatically with exponential backoff:
Default max_retries is 3. Once exhausted, the job transitions to dead.

Built-in Job Handlers

Admin API

The Jobs API is restricted to superadmins only. It provides a system-wide view across all accounts.

Job Statistics

Get aggregate counts and failure rate:
Response:
The failure_rate is calculated as (failed + dead) / (completed + failed + dead).

List Jobs

Filter by status, queue, or handler:

Retry a Job

Manually retry a dead, failed, or retrying job:
This resets the job to pending with attempt_number reset to 0.

Cancel a Job

Cancel a pending job (only pending jobs can be cancelled):

Job Fields

Worker Configuration

The job worker is configured via application settings:

Graceful Shutdown

When the worker shuts down, any currently running job is reset to pending so it can be picked up again.

Stale Job Recovery

Jobs stuck in running state longer than the execution timeout are automatically recovered and reset to pending.