【发布时间】:2014-05-03 18:10:48
【问题描述】:
在运行如下所示的迁移时:
def up
FileThumb.destroy_all # delete existing thumbnails
File.update_all(thumbs_completed: false) # reset the process flags
File.find_each do |file|
file.delay(priority: 8).create_thumbs # delay thumbnail creation of each file.
end
end
我收到超出内存报价
heroku/run.8084: source=run.8084 dyno=heroku.3498745.1deecee6-afd0-466a-8020-38273704608c sample#load_avg_1m=0.00 sample#load_avg_5m=0.00 sample#load_avg_15m=0.02
heroku/run.8084: source=run.8084 dyno=heroku.3498745.1deecee6-afd0-466a-8020-38273704608c sample#memory_total=571.66MB sample#memory_rss=511.89MB sample#memory_cache=0.00MB sample#memory_swap=59.78MB sample#memory_pgpgin=1811564pages sample#memory_pgpgout=1680521pages
heroku/run.8084: Process running mem=571M(111.7%)
heroku/run.8084: Error R14 (Memory quota exceeded)
【问题讨论】:
-
devcenter.heroku.com/articles/… 您正在使用比测功机更多的内存。它仍然应该作为 R14 错误而不是 R15 工作。
-
您是否尝试过对
find_each使用较小的批量? -
虽然我没有收到 R15 错误,但它在插入时挂起并停止。较小的批量确实适用于 find_in_batches
标签: ruby-on-rails postgresql heroku delayed-job rails-migrations