-
Notifications
You must be signed in to change notification settings - Fork 2
Locks
Daniel Pepper edited this page Mar 13, 2022
·
3 revisions
Each call to .limit yields a lock when successful, or an exception when the limiter is out of capacity.
-
.capacity- capacity limitation -
.contention- capacity being utilized -
.locked?- whether the lock is currently being held -
.release- release capacity being held
eg.
Berater(*) do |lock|
lock.contention
end
# or inline
lock = Berater(*).limit
...
lock.releaseWhen limiters are used in block mode, locks can largely be ignored since .release is automatically called after the block executes.