Queue System
Run background tasks after your function returns to the user. Perfect for sending emails, processing images, updating analytics, or calling external APIs without making users wait.Overview
Key features:- Non-blocking — returns immediately to the user
- Fire-and-forget — no waiting for completion
- Works in both HTTP and WebSocket functions
- Not persisted — lost on server restart
Basic Usage
Queue a Local Function
Call Another Cloud Function
API Reference
queue.add(function_name, **params)
Queue a local function defined in the same file.queue.call_function(function_name, **params)
Call another deployed cloud function in the background.Error Handling
Queue tasks that fail are not retried automatically. Handle errors inside the queued function:Common Patterns
User Registration
Order Processing
Limitations
| Limit | Value |
|---|---|
| Max tasks per execution | 100 |
| Task timeout | 20 seconds |
| Persistence | Not persisted (lost on restart) |
| Retry on failure | No automatic retry |
When to Use Queue
Use queue for:- Sending emails after signup/purchase
- Updating analytics after an action
- Notifying external services
- Any non-critical background work
- Critical operations that must succeed
- Long-running tasks (use cron jobs)
- Tasks that depend on each other in order
- Recurring/scheduled tasks (use cron jobs)
