Skip to content

Async tasks ​

Covers queues, scheduled jobs and mail delivery tasks.

Queue configuration ​

ConnectionQueue namePurpose
redisdefault (QUEUE_NAME)General async jobs
mailemails (MAIL_QUEUE_NAME)Mail delivery

The worker process consumes both queues without blocking each other. Slow SMTP does not stall background tasks.

Job definition ​

Implement Signature(), Handle() and optionally ShouldRetry(), then register in bootstrap/jobs.go. Pass only primitive arguments to avoid deserialization failures.

Failure handling ​

  • Jobs returning an error land in system_failed_jobs
  • ShouldRetry decides whether to retry and the backoff
  • The admin UI shows failure reasons and supports manual replay

Scheduled jobs ​

Register scheduled jobs with the scheduler and deduplicate via OnOneServer() and SkipIfStillRunning(). The web role does not start the scheduler, so multiple web instances cannot duplicate execution.

WARNING

In split deployments worker must stay running. web only enqueues; tasks pile up when worker is down.

Next steps ​