具有长时间外部查询的Heroku 30秒超时的解决方法 [英] Workaround for Heroku 30 second timeout w/ long external query

查看:108
本文介绍了具有长时间外部查询的Heroku 30秒超时的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:这篇文章中有些东西将不是最佳实践.警告:)

Note: There are going to be things in this post which are less-than-best-practices. Be warned :)

  • 我正在管理一个连接到微实例AWS服务器的管理仪表板.
  • 数据库有数千万条记录.
  • 大多数查询会在几秒钟内返回,但有些查询可能需要一到两分钟才能返回,这是基于我无法控制的.

由于Heroku的30秒限制(https://devcenter.heroku.com/articles/request-timeout),我需要找到一些时间来保持连接打开直到查询返回. Heroku确实说过,您可以在此期间通过向客户端发送字节来节省时间,这又使您多花了55秒.

Due to Heroku's 30-second limit (https://devcenter.heroku.com/articles/request-timeout), I need to find some way to buy time to keep the connection open until the query returns. Heroku does say that you can buy time by sending bytes to the client in the meantime, which buys you another 55 seconds.

无论如何,只是想知道你们是否有解决办法来拖延Heroku的时间.谢谢!

Anyways, just curious if you guys have a solution to stall time for Heroku. Thanks!

推荐答案

您可以将其分解为多个查询.

You could break down the thing into multiple queries.

您可以发送查询,让您的AWS服务器立即响应,只是说它接收到查询,然后一旦提取数据,就通过POST请求将该数据发送到您的Heroku实例.

You may send a query, have your AWS server respond immediately just saying that it received query and then once it pulls the data, have it send that data via a POST request to your Heroku instance.

这篇关于具有长时间外部查询的Heroku 30秒超时的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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