Skip to content

Instantly share code, notes, and snippets.

View victorhazbun's full-sized avatar
🚀
Work work work

Victor Hazbun Anuff victorhazbun

🚀
Work work work
View GitHub Profile
@victorhazbun
victorhazbun / Benchmark.rb
Created October 7, 2023 18:44 — forked from mperham/Benchmark.rb
Leaky bucket limiter usage with Sidekiq Enterprise
require 'benchmark'
require 'sidekiq-ent/limiter'
COUNT = 10_000
Benchmark.bmbm(30) do |x|
x.report("leaky") do
COUNT.times do |count|
lmt = Sidekiq::Limiter.leaky("leaky_#{count%100}", 10, 10, wait_timeout: 0, policy: :skip)
lmt.within_limit do