I used to think that if a user needed an immediate response, the server had to finish every step before replying. Background jobs seemed like a good fit for nightly reports and scheduled cleanup. I couldn’t see why I’d use one for something as immediate as signing up.
Then I read Bmo Glitch Code’s guide to background jobs and task queues. The registration example made me change my mind. It also made me wonder what happens when the work I move into the background is the very thing the user is waiting for. The Complete Guide to Background Jobs and Task Queues
Why make someone wait for a welcome email?
In the lesson’s example, the server validates the signup details, creates the account, and sends a welcome email. If the server waits for the email provider before replying, the whole request takes about 3.35 seconds. If it queues the email for a worker, the example drops to 360 milliseconds. Those are illustrative timings, but the difference is easy to understand. The user can start using the app as soon as the account is ready, and the worker can retry delivery if the email provider is temporarily unavailable.
This is what I’d missed about immediate responses. I’d been thinking about everything the system had to do after a signup. The user’s immediate question was much simpler. Did my account get created? Once the server has saved the account, it can answer that question.
What if the email is required to sign in?
A welcome email made the decision easy. A verification email made me think again.
Imagine I click Sign up, see “Account created. Check your inbox to verify your email,” and then wait two minutes for the code. The API responded in under half a second. From my side of the screen, signup still took two minutes.
I’d still send the verification email through a background job. That gives the server a way to confirm that the account is pending verification and lets the worker handle delivery and retries. If signing in depends on that email, its delivery time is part of the signup experience.
What if the queue itself is overloaded?
My first answer was to give verification emails a dedicated queue and workers. That keeps a batch of newsletters or a large export from delaying someone’s login. Then I asked what happens when signups alone overwhelm that queue. Azure’s priority queue pattern
Say the email provider accepts 60 messages a second and signups generate 100. The backlog grows by 40 messages every second that gap persists. More workers can help when worker capacity is the bottleneck. Once the provider reaches its limit, the options are to reduce incoming work, increase provider capacity, or let the backlog drain when demand falls. The queue buys time during a burst, and a sustained gap eventually shows up as a longer wait for users. Azure’s queue-based load leveling pattern
That also changed how I thought about Resend. If the original email is still waiting, adding another job creates more work for the same signup. I’d reuse a pending send, rate-limit new attempts, and tell users when delivery is delayed. I’d also save the account and the intent to send its verification email in the same database transaction, so the job can still be picked up after a temporary queue outage. AWS guidance on queue backlogs · AWS guidance on the transactional outbox
What I’d measure now
I’d measure the time it takes to confirm signup, the time it takes to hand the email to the provider, and the time it takes users to complete verification. If the signup endpoint is still fast while the oldest verification job has been waiting a minute, I know where to start looking.
I used to ask whether a feature that needed an immediate response should use a background job at all. Now I ask what the user needs to know right away and what they need before they can move on. For a welcome email, those are separate moments. For a verification email, both are part of signup.
