【发布时间】:2019-08-24 15:46:58
【问题描述】:
我在 django-rest 应用程序中使用 celery 运行定期任务,该应用程序从具有多个表的大型 Postgres 数据库中提取数据,任务启动良好并提取一些数据约 50 分钟,然后因此错误而失败
client_idle_timeout
server closed the connection unexpectedly, This probably means the server terminated abnormally before or while processing the request.
可能是什么问题导致此问题,我该如何解决?
【问题讨论】:
-
可以分享代码吗?
-
这是一个 50 分钟的任务,并且正在提取数据……内存不足? postgres 使您的连接超时,因为您在处理过程中将其保持打开的时间过长?
-
我能够通过增量查询少量数据来解决问题,从而防止超时。谢谢@paraschauhan 和 Andrew
标签: django postgresql django-rest-framework celery