Class: Wurk::Limiter::Unlimited
- Inherits:
-
Object
- Object
- Wurk::Limiter::Unlimited
- Defined in:
- lib/wurk/limiter/unlimited.rb
Overview
No-op for the tests + bypass scenarios documented in §1.8. The within_limit block runs unconditionally and the introspection methods all return zeros so dashboards render predictably.
Instance Method Summary collapse
- #delete ⇒ Object
- #fingerprint ⇒ Object
- #name ⇒ Object
- #options ⇒ Object
- #reset ⇒ Object
- #size ⇒ Object
-
#status ⇒ Object
Uniform status shape (#16): no limit, always available.
- #type ⇒ Object
-
#within_limit(**_kwargs, &block) ⇒ Object
Accept all the kwargs the other limiters take so a worker can swap ‘limiter = Sidekiq::Limiter.unlimited` in tests without touching call sites.
Instance Method Details
#delete ⇒ Object
17 |
# File 'lib/wurk/limiter/unlimited.rb', line 17 def delete = nil |
#fingerprint ⇒ Object
15 |
# File 'lib/wurk/limiter/unlimited.rb', line 15 def fingerprint = Digest::SHA256.hexdigest('unlimited') |
#name ⇒ Object
11 |
# File 'lib/wurk/limiter/unlimited.rb', line 11 def name = 'unlimited' |
#options ⇒ Object
13 |
# File 'lib/wurk/limiter/unlimited.rb', line 13 def = {} |
#reset ⇒ Object
16 |
# File 'lib/wurk/limiter/unlimited.rb', line 16 def reset = nil |
#size ⇒ Object
14 |
# File 'lib/wurk/limiter/unlimited.rb', line 14 def size = 0 |
#status ⇒ Object
Uniform status shape (#16): no limit, always available.
20 21 22 |
# File 'lib/wurk/limiter/unlimited.rb', line 20 def status { used: 0, limit: nil, reset_at: nil, available?: true } end |
#type ⇒ Object
12 |
# File 'lib/wurk/limiter/unlimited.rb', line 12 def type = :unlimited |
#within_limit(**_kwargs, &block) ⇒ Object
Accept all the kwargs the other limiters take so a worker can swap ‘limiter = Sidekiq::Limiter.unlimited` in tests without touching call sites. `points`-style callers pass an `estimate:` and expect a `|handle|` block param — we yield a zero-cost handle just in case.
28 29 30 31 32 33 34 35 36 |
# File 'lib/wurk/limiter/unlimited.rb', line 28 def within_limit(**_kwargs, &block) raise ArgumentError, 'block required' unless block if block.arity.zero? block.call else block.call(Points::Handle.new(self, 0)) end end |