Rails:PQconsumeInput()服务器意外关闭了连接

时间:2018-04-05 09:01:54

标签: ruby-on-rails postgresql rubygems resque

我正在使用rails模块,我需要处理大量数据(即25000+),这些数据会根据预定义的频率进行更新。

我创建了resque worker,在其中使用Parallel Gem事件发生并行,并且还使用了ActiveRecord::Base.transaction(requires_new: true)事务块,其中将运行并行进程。

但是在执行了大约20K的记录后,它会抛出错误:

Error in perform: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly 
    This probably means the server terminated abnormally 
    before or while processing the request. 
ROLLBACK 

环境详情: Rails 5,postgres DB

任何人都有任何建议,有什么改变可以帮助我摆脱这个错误。

0 个答案:

没有答案
相关问题