Skip to content

How it works?

Edge Worker is a task queue worker that gets messages from a queue and calls user functions with their payload.

Features

Under the hood, it wraps Supabase Background Tasks and adds a lot of useful features:

  • retries with delays
  • concurrency control
  • observability (heartbeats, logging)
  • horizontal scaling (by deploying multiple edge functions for the same queue)

CPU/clock limits

Edge Worker treats Edge Function termination due to CPU/clock limits as an expected occurrence and includes extra measures to handle it as part of normal operations:

  • stops polling as soon as the soft limit is reached
  • makes extra effort to gracefully abort pending tasks with abort signals
  • uses PGMQ’s visibility timeout to ensure no message is ever lost
  • spawns new instances automatically for continuous operations
  • pings the database with heartbeats to ensure the worker’s health