Skip to content

hueristiq/hq-go-limiter

Repository files navigation

hq-go-limiter

made with go go report card license maintenance open issues closed issues contribution

A Go (Golang) package for handling rate limiting.

Resource

Features

Installation

To install hq-go-limiter, run:

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

Make sure your Go environment is set up properly (Go 1.x or later is recommended).

Usage

package main

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

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

	ltr := hqgolimiter.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

Contributions are welcome and encouraged! Feel free to submit Pull Requests or report Issues. For more details, check out the contribution guidelines.

A big thank you to all the contributors for your ongoing support!

contributors

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.

Releases

No releases published

Packages

No packages published