Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

services:
valkey:
image: valkey/valkey:latest
ports:
- 6379:6379
options: >-
--health-cmd "valkey-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Install dependencies
run: go mod download

- name: Run tests
run: go test -v ./...
env:
TEST_REDIS_ADDR: localhost:6379
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ ruelimit implements high-performance rate limiting algorithms with both in-memor
Distributed variants built on top of [redis/rueidis](https://github.com/redis/rueidis) with auto-pipelining.
The in-memory variants use a sharded lockable map.

[Godoc](https://pkg.go.dev/github.com/iamcalledrob/ruerate)
[![Go Reference](https://pkg.go.dev/badge/github.com/iamcalledrob/ruerate.svg)](https://pkg.go.dev/github.com/iamcalledrob/ruerate)

[![Test](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml/badge.svg)](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml)


## Features
Expand All @@ -30,7 +32,7 @@ with occasional bursts.

### Configuration
The `tokenbucket.LimiterOpts` struct defines the bucket behavior:
```
```golang
type LimiterOpts struct {
RatePerSec float64 // How many tokens are added to the bucket per second
Capacity int64 // Maximum tokens the bucket can hold
Expand Down Expand Up @@ -81,7 +83,7 @@ loops, i.e. with the local in-memory variants.

### Configuration
The `backoff.LimiterOpts` struct defines the bucket behavior:
```
```golang
type LimiterOpts struct {
BaseWait time.Duration // Minimum wait between attempts
MaxWait time.Duration // Maximum "lockout" duration
Expand Down