lib/sequel/plugins/with_lock.rb in umbrellio-sequel-plugins-0.5.1.27 vs lib/sequel/plugins/with_lock.rb in umbrellio-sequel-plugins-0.6.0
- old
+ new
@@ -3,16 +3,16 @@
module Sequel::Plugins::WithLock
module InstanceMethods
# Execute block with lock
#
# @yield
- def with_lock(savepoint: true)
+ def with_lock(mode = "FOR NO KEY UPDATE", savepoint: true)
return yield if @__locked
@__locked = true
begin
db.transaction(savepoint: savepoint) do
- lock!
+ lock!(mode)
yield
end
ensure
@__locked = false
end