Don't create new transactions if we already have one

Change-Id: Ife6c14c0c9f373af8c8f675dfe68304e44cd9ac8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/318157
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
This commit is contained in:
Jacob Burroughs 2023-05-15 08:48:19 -05:00
parent 2863c4dd27
commit 3a0d2d7c1b
1 changed files with 9 additions and 2 deletions

View File

@ -258,10 +258,17 @@ module PostgreSQLAdapterExtensions
end
def with_max_update_limit(limit)
transaction do
if current_transaction
execute("SET LOCAL inst.max_update_limit = #{limit}")
yield
ret = yield
execute("SET LOCAL inst.max_update_limit = DEFAULT")
else
transaction do
execute("SET LOCAL inst.max_update_limit = #{limit}")
ret = yield
end
end
ret
end
def quote(*args)