加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – Heroku:我有一个超过30秒的请求,它会中断

发布时间:2020-12-17 03:27:43 所属栏目:百科 来源:网络整理
导读:我有一个超过30秒的请求,它会中断. 这是什么解决方案?我不确定我是否会添加更多的dynos. 谢谢 解决方法 您可能应该看到 the Heroku devcenter article,因为这些信息会更有帮助,这里有一个小小的总结: 要回答超时问题: Cedar supports long-polling and st
我有一个超过30秒的请求,它会中断.

这是什么解决方案?我不确定我是否会添加更多的dynos.

谢谢

解决方法

您可能应该看到 the Heroku devcenter article,因为这些信息会更有帮助,这里有一个小小的总结:

要回答超时问题:

Cedar supports long-polling and streaming responses. Your app has an initial 30 second window to respond with a single byte back to the client. After each byte sent (either recieved from the client or sent by your application) you reset a rolling 55 second window. If no data is sent during the 55 second window your connection will be terminated.

(也就是说,如果你有Cedar而不是Aspen或Bamboo,你可以每隔30秒左右发送一个字节来欺骗系统.它可能会起作用.)

要回答你的dynos问题:

Additional concurrency is of no help whatsoever if you are encountering request timeouts. You can crank your dynos to the maximum and you’ll still get a request timeout,since it is a single request that is failing to serve in the correct amount of time. Extra dynos increase your concurrency,not the speed of your requests.

(也就是说,不要费心添加更多的dynos.)

request timeouts:
检查代码是否存在无限循环,如果你正在做大事:

If so,you should move this heavy lifting into a background job which can run asynchronously from your web request. See 07002 for details.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读