How to increase hoke Heroku 30s timeout

I am running a rails application that has a webservice json request from a local client developed in C ++ (post command with multipart json form, download a streaming file)

I already read about Heroku docs about mesh routing , mentioned the limitation of Heroku's 30th for http connections and a long poll , citing working speakers.

During my call, I process PDF documents and insert a signature in them. These pdfs can be either 100 kb or 11 mb (or possibly more).

I understand that in the end I will have to do this action in the background, but I would like to avoid this before I fully had to.

Do you know any way to increase this timeout?

As you can see in my code below, I process my document after saving it (I did it inside after_save , but changed it to the controller, hoping to send a response before processing).

I would have expected the client to get a response before processing the document, but I still have a timeout on the hero side and an error on my client side.

All this works fine with smaller documents, but for a document with 121 pages of PDF only 400 KB, it is reset ..

At the end, my file is uploaded, so all I need is an answer to go to my client application before sending a timeout response ...

Any suggestions?

my mistake:

  at=error code=H12 desc="Request timeout" method=POST path=/documents host=fierce-beach-2720.herokuapp.com fwd="81.193.155.217/bl4-155-217.dsl.telepac.pt" dyno=web.1 queue=0ms wait=0ms connect=1ms service=32272ms status=503 bytes=0 

my controller:

 respond_to do |format| if @document.save! format.html { redirect_to root_path, :flash => { :success => 'Document was successfully created.'} } format.json { render json: @document, status: :created, location: @document} @document.document_process 
+4
source share
2 answers

I ended up using the deferred task + workless , and now my working dynos only start when they need to.

Since geroku has a free free hour for each application plan, if you have little use, you can continue to use it for free.

+2
source

suggestion: use the background process!

I read that you want to avoid it, but not around it! it’s best practice in web applications to get back to the client as quickly as possible, as he frees up resources. when you have only one dyno running in heroku and you have several requests, they will be blocked for your timeout and no user will be able to access your page. you can easily have a denial of service when you have such lengthy processes.

if you don't want to run background processes due to cost, look at freemium: https://github.com/phoet/freemium

+1
source

All Articles