如何增加Heroku 30s h12超时 [英] How to increase Heroku 30s h12 timeout

查看:179
本文介绍了如何增加Heroku 30s h12超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个rails应用程序,它有一个来自本地客户端的json webservice调用,这个客户端是用c ++开发的(一个带多段json表单的post命令,上传一个流式文件)

我已阅读Heroku有关路由网格的文档,提及对于http连接的30年代Heroku限制,以及关于长轮询备选方案,指的是工作人员dynos 。

在我的电话中,我处理pdf文档并在其中插入签名。这个pdf文档可以是100kb或11Mb(或者更多)。



我知道我最终必须在后台进程上执行此操作,但我会在我绝对需要之前避免这样做。



你知道任何增加超时的方法吗?



<正如你在我的代码中可能会看到的那样,我在保存后处理文档(我在 after_save 中进行了处理,但更改为希望发送的控制器处理前的响应)。



我希望客户端能够在文档处理之前得到响应,但是我仍然在heroku方面有一个超时,并且在我的客户端发生错误侧。



这一切都适用于较小的文档,但对于只有400kb的121页pdf文档而言,它会一炮走红。



最后,我的文件被上传了,所以我需要的是让响应在发送超时响应之前进入我的客户端应用程序...



任何建议?



我的错误:

  at =错误代码= H12 desc =Request timeoutmethod = POST path = / documents host = fierce-beach-2720.herokuapp.com fwd =81.193.155.217/bl4-155-217.dsl.telepac.ptdyno = web.1 queue = 0ms wait = 0ms connect = 1ms service = 32272ms status = 503 bytes = 0 

我的控制器:

  respond_to do | format | 
if @ document.save!
format.html {redirect_to root_path,:flash => {:success => 'document has been created。'}}
format.json {render json:@document,status::created,location:@document}
@ document.document_process
delayed_jobrel =nofollow>延迟工作 + 无工作状态,现在只有我的工作人员dynos在需要时运行。



由于heroku每个应用程序的免费计划免费使用750小时,因此当您的使用率较低时,您可以继续免费使用。

I'm running a rails app, which has a json webservice call from a local client developed in c++ (a post command with a multipart json form, uploading a streamed file)

I already read on Heroku docs about routing mesh, mentioning the 30s Heroku limit for http connections, and about the long polling alternative, referring to worker dynos.

During my call I process pdf documents and insert a signature into them. This pdf documents can either be 100kb or 11Mb (or perhaps more).

I understand that I'll eventually have to do this action on a background process, but I would like to avoid doing it before I absolutely have to.

Do you know of any way of increasing this timeout?

As you may see in my code below, I am processing my document after it gets saved (I was doing this inside an after_save, but changed to the controller hoping to send the response before processing).

I would so expect that the client would get a response before the document processing, but I'm still having a timeout on the heroku side, and an error on my client side.

This all works fine with smaller documents, but for a 121 pages pdf document with only 400kb, it blows off..

In the end, my file gets uploaded, so all I need is for that response to proceed to my client app before the timeout response is sent...

Any suggestions?

my error:

 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

解决方案

I've ended using delayed job + workless, and now my worker dynos only run when they need to.

As heroku has the free 750 hours free per app plan, when you have low usage, you might be able to keep using it for free.

这篇关于如何增加Heroku 30s h12超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆