The Story
Your trip planner is humming along. Users sign up, generate itineraries with streaming, and process photos in the background with QStash from Lesson 18. Each photo gets its own callback, retries happen automatically, and nobody stares at a spinner. Things are good.
Then your app gets popular.
Three users upload photos at the same time. User A uploads 20 photos from Barcelona. User B uploads 15 from Tokyo. User C uploads 10 from Paris. That’s 45 QStash callbacks hitting your server in rapid succession. Each one calls your AI captioning service, each one resizes a photo, each one writes to storage.
And your AI captioning service has a rate limit. Ten requests per minute. You just sent it 45 requests in the span of a few seconds. Requests 1 through 10 succeed. Requests 11 through 45 get rejected with “rate limit exceeded.” QStash retries them, but they fail again because the rate limit hasn’t reset yet. Eventually some succeed on retry, some don’t. Users see random failures. Some photos get captions, some get errors.
But it gets worse. While the photo callbacks are failing and retrying, another user tries to generate a trip. Their request needs the same AI service the flood is hammering, and the rate limit doesn’t care which feature is asking. Their trip fails too. One burst of uploads just degraded the experience for everyone.
This lesson continues with the full course
The story intro above is free to read. The full lesson (prompts, explanations, and adapt-it exercises) requires the Sell It ($149) tier or above.
New here? Lesson 1 is free and ends with a working app.
Already bought a lower tier? Log in, you'll only pay the difference to upgrade.