https://github.com/dpep/berater_rb
work within limits
https://github.com/dpep/berater_rb
concurrency-limiter limiter rate-limiter
Last synced: 3 months ago
JSON representation
work within limits
- Host: GitHub
- URL: https://github.com/dpep/berater_rb
- Owner: dpep
- License: mit
- Created: 2017-08-29T02:53:03.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T15:07:06.000Z (11 months ago)
- Last Synced: 2025-07-01T04:23:55.032Z (3 months ago)
- Topics: concurrency-limiter, limiter, rate-limiter
- Language: Ruby
- Homepage:
- Size: 462 KB
- Stars: 20
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Berater
======

[](https://codecov.io/gh/dpep/berater_rb)All systems have limits, beyond which they tend to fail. Berater makes working within limits easy and the inevitable failures more graceful.
```ruby
require 'berater'
require 'redis'Berater.configure do |c|
c.redis = Redis.new
endBerater(:key, 3) do
# allow only three simultaneous requests with a concurrency limiter
endBerater(:key, 2, interval: :minute) do
# or do work twice per minute with a rate limiter
end
```See [documentation](https://github.com/dpep/berater_rb/wiki) for details.
----
## ContributingYes please :)
1. Fork it
1. Create your feature branch (`git checkout -b my-feature`)
1. Ensure the tests pass (`bundle exec rspec`)
1. Commit your changes (`git commit -am 'awesome new feature'`)
1. Push your branch (`git push origin my-feature`)
1. Create a pull request----
### Inspired byhttps://stripe.com/blog/rate-limiters
https://github.blog/2021-04-05-how-we-scaled-github-api-sharded-replicated-rate-limiter-redis
[@ptarjan](https://gist.github.com/ptarjan/e38f45f2dfe601419ca3af937fff574d)
https://en.wikipedia.org/wiki/Leaky_bucket