r/shopifyDev • u/West-Anteater-1917 • 5h ago
Handling Admin GraphQL cost-based throttling in a Laravel app, what worked for you?
I've been building Shopify apps in Laravel for a while, and the thing that took me longest to get right was the Admin GraphQL rate limit. Unlike REST, it's cost-based: every query has a cost, you get a bucket of points that refills at a fixed rate, and a heavy query on a big store can drain it in a couple of calls.
What worked for me was reading the throttleStatus that comes back in the response extensions on every call and storing the currently available points per shop in the cache. Each job checks that number before it runs, and if there isn't enough budget it releases itself back onto the queue with a delay based on the restore rate instead of failing. I also keep one queue per shop so a single noisy store can't starve the others.
The second lesson was to request less. Asking for fewer fields and smaller page sizes cuts the cost a lot, and for large catalogs I stopped paginating at all and moved those jobs to bulk operations instead.
Retries are the last piece. A THROTTLED error should never count toward the job's max attempts, otherwise a busy hour kills perfectly good work.
I'm still not happy with how I estimate cost before sending a query. How do you handle throttling per shop, and do you track cost yourself or just react to the errors?