Ad

Heroku Server Timeout For Shopify App

I have a Shopify App on a Heroku Server. One of the calls I make to that app is a POST where I send a Collection, an Array of Products and an Array of Customers. From there I make multiple API Calls to the Shopify Admin to create all those things. This is currently working great if there is just a few products and customers to create. Heroku, however, has a 30-second timeout limit. This cannot be changed. The only way around it is to send a "Heartbeat" and then you get an additional 55 seconds. I have not figured out how to send a "Heartbeat" back and continue on. I tried Returning a Status 100 but that didn't work. Other than splitting this into multiple calls. Is there a better way to do it?

Ad

Answer

You're architecting your App poorly. If you make a POST to your App, organize the incoming data, send it to a background job to get processed, and then return a 200 OK back to your App if you used XHR, or splash up a page in your App saying "Thanks, we're working on things"...

That way you keep your merchant client informed, things work fine, and you have no chance of blowing out on a 30 second timeout.

Ad
source: stackoverflow.com
Ad