whatsapp
Connector
¶ User-initiated WhatsApp mutations
Foreground traffic that a user is waiting on. This queue must stay free of slow background work.
Queue ownership
Every queue has one consumer and one job class. The connector owns the WhatsApp-facing queues, API workers own orchestration, and slow background work never shares a lane with user-initiated sends.
whatsapp
whatsapp
Connector
Foreground traffic that a user is waiting on. This queue must stay free of slow background work.
whatsapp_media
Connector
Background media downloads run here so they cannot occupy slots needed for sends.
whatsapp_avatars
Connector
Background avatar fetches run here, isolated from foreground traffic.
scheduled
flow_runs
broadcasts
API workers
These workers decide when to send, then call the same producer functions as synchronous endpoints. They never talk to WhatsApp directly.
whatsapp queue
Media downloads and avatar fetches belong on their own queues.
They go through the producer functions, which enqueue onto the connector queues.
History imports
First-time WhatsApp links that require history import may be queued before a QR is requested, so only a bounded number of heavy imports run concurrently. The queue and its admission limits prevent connector memory and CPU freezes; abandoned pairing screens must not permanently hold slots.
The API exposes POST /organizations/{org}/channels/{id}/pairing-lease, which returns a PairingQueueState: queued flag, pairing_queued_at, position, queue_length, importing, limit, and admitting (server memory alarm).
Open pairing screens renew their lease periodically: the client renews every 20s and the server lease allows about 90s. Each renewal patches the channels cache, so promotions are picked up even if realtime events were missed.
If the user closes the pairing screen while queued, the client sends DELETE pairing-queue so the next queued channel can begin importing immediately.
Bounding concurrent history imports keeps heavy first-link imports from exhausting connector memory and CPU, the same reason slow work stays off the whatsapp queue.
Production safety
Treat queue ownership and placement as a safety rule. Rebalancing or consolidating queues can reintroduce incidents where background jobs block foreground traffic.