Mongoid-Locker supports only 5
, 6
and 7
versions of Mongoid.
Since this version Mongoid::Locker
uses unique name of locking and time is set by MongoDB. Mongoid::Locker
no longer uses locked_until
field and this field may be deleted with User.all.unset(:locked_until)
. You must define new locking_name
field of String
type.
class User
include Mongoid::Document
include Mongoid::Locker
field :locking_name, type: String
field :locked_at, type: Time
end
The options :timeout
and retry_sleep
of #with_lock
method was deprecated and have no effect. For details see RubyDoc.info.
If you handle Mongoid::Locker::LockError
error then this error should be renamed to Mongoid::Locker::Errors::DocumentCouldNotGetLock
.
Mongoid::Locker
no longer defines locked_at
and locked_until
fields when included. You must define these fields manually.
class User
include Mongoid::Document
include Mongoid::Locker
field :locked_at, type: Time
field :locked_until, type: Time
end
You can customize the fields used with a locker
class method or via a global configure
. See Customizable :locked_at and :locked_until field names for more information.
See #55 for more information.