Project

berater

0.07
No release in over a year
work...within limits
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

>= 3
 Project Readme

Berater

Gem codecov

All systems have limits, beyond which they tend to fail. Berater makes working within limits easy and the inevitable failures more graceful.

require 'berater'
require 'redis'

Berater.configure do |c|
  c.redis = Redis.new
end

Berater(:key, 3) do
  # allow only three simultaneous requests with a concurrency limiter
end

Berater(:key, 2, interval: :minute) do
  # or do work twice per minute with a rate limiter
end

See documentation for details.


Inspired by

https://stripe.com/blog/rate-limiters

https://github.blog/2021-04-05-how-we-scaled-github-api-sharded-replicated-rate-limiter-redis

@ptarjan

https://en.wikipedia.org/wiki/Leaky_bucket