lib/good_job/lockable.rb in good_job-1.5.0 vs lib/good_job/lockable.rb in good_job-1.6.0
- old
+ new
@@ -90,12 +90,10 @@
# @!method advisory_locked
# @!scope class
# @return [ActiveRecord::Relation]
scope :owns_advisory_locked, -> { joins_advisory_locks.where('"pg_locks"."pid" = pg_backend_pid()') }
- # @!attribute [r] create_with_advisory_lock
- # @return [Boolean]
# Whether an advisory lock should be acquired in the same transaction
# that created the record.
#
# This helps prevent another thread or database session from acquiring a
# lock on the record between the time you create it and the time you
@@ -105,9 +103,11 @@
#
# @example
# record = MyLockableRecord.create(create_with_advisory_lock: true)
# record.advisory_locked?
# => true
+ #
+ # @return [Boolean]
attr_accessor :create_with_advisory_lock
after_create -> { advisory_lock }, if: :create_with_advisory_lock
end