workaround receive error with many articles

This commit is contained in:
wvengen 2014-08-22 09:35:05 +02:00
parent 63d52db91b
commit d906a7342f
1 changed files with 16 additions and 15 deletions

View File

@ -145,7 +145,9 @@ class OrdersController < ApplicationController
# changed, rest_to_tolerance, rest_to_stock, left_over
counts = [0] * 4
cunits = [0] * 4
OrderArticle.transaction do
# This was once wrapped in a transaction, but caused
# "MySQL lock timeout exceeded" errors. It's ok to do
# this article-by-article anway.
params[:order_articles].each do |oa_id, oa_params|
unless oa_params.blank?
oa = OrderArticle.find(oa_id)
@ -163,7 +165,6 @@ class OrdersController < ApplicationController
oa.save!
end
end
end
return nil if counts[0] == 0
notice = []
notice << I18n.t('orders.update_order_amounts.msg1', count: counts[0], units: cunits[0])