Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

ratelimit

Go package for rate limiting of functions using a leaky bucket algorithm

Build Status

Installation

Simply run

go get -u github.com/iand/ratelimit

Documentation is at http://godoc.org/github.com/iand/ratelimit

Usage

Example use:

import "github.com/iand/ratelimit"

func main() {
	limiter := ratelimit.PerSecond(5, 100)

	// Following should be executed at a rate of 5 per second
	for i := 0; i < 100; i++ {
		limiter.Do(func() { println("hello") })
	}

	// Blocks until the rate limiter has finished
	limiter.Drain()
}

LICENSE

This is free and unencumbered software released into the public domain. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

About

Go package for rate limiting of functions using a leacky bucket algorithm

Resources

License

Releases

No releases published

Languages

You can’t perform that action at this time.