Skip to content

hueristiq/hq-go-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hq-go-limiter

made with go license maintenance open issues closed issues contribution

A Go(Golang) package for handling rate limiting.

Resource

Features

Installation

To install the package, run the following command in your terminal:

go get -v -u github.com/hueristiq/hq-go-limiter

This command will download and install the hq-go-limiter package into your Go workspace, making it available for use in your projects.

Usage

Here's a simple example demonstrating how to use hq-go-limiter:

package main

import (
	"fmt"
	limiter "github.com/hueristiq/hq-go-limiter"
)

func main() {
	options := &limiter.Options{
		RequestsPerMinute: 40,
		MinimumDelayInSeconds: 2,
	}

	ltr := limiter.New(options)

	// Make 10 requests and ensure that they are rate limited.
	for i := 1; i <= 10; i++ {
		ltr.Wait()
		fmt.Printf("Request %d made at %v\n", i, time.Now())
	}
}

Contributing

We welcome contributions! Feel free to submit Pull Requests or report Issues. For more details, check out the contribution guidelines.

Licensing

This package is licensed under the MIT license. You are free to use, modify, and distribute it, as long as you follow the terms of the license. You can find the full license text in the repository - Full MIT license text.

Credits

Contributors

A huge thanks to all the contributors who have helped make hq-go-limiter what it is today!

contributors

Similar Projects

If you're interested in more packages like this, check out:

Uber's ratelimitProject Discovery's ratelimit