skip to Main Content

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?

2

Answers


  1. Don’t know what the ruby answer would be but Heroku’s article on this is here and indicates that you just need to send few bytes after each operation to get an additional 55s per write operation.

    I presume ruby has some way to get access to the response stream so even a space character sent down may do the trick — that way you can send a bunch of spaces and then a final JSON response.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search