fix excessive update updating could_be_locked

fixes CANVAS-KQVF, LF-566

Change-Id: I2ce19e5bca2570ad1a4bfddc3f0542532f992cb0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324597
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jake Oeding <jake.oeding@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2023-08-07 13:36:41 -06:00
parent 0af047da4a
commit 8d4eff6e5b
1 changed files with 4 additions and 2 deletions

View File

@ -208,8 +208,10 @@ class ContentTag < ActiveRecord::Base
klass = type.constantize
next unless klass < ActiveRecord::Base
if klass.new.respond_to?(:could_be_locked=)
klass.where(id: ids).update_all_locked_in_order(could_be_locked: true)
next unless klass.new.respond_to?(:could_be_locked=)
ids.sort.each_slice(1000) do |slice|
klass.where(id: slice).update_all_locked_in_order(could_be_locked: true)
end
end
end