-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rename package / thread safety (#3)
* fix: make bucket concurrency safe - don't rely on the rate limiter to take care of safe access * fix: remove unsafe code - give buckets their own concurrency safety - finer locking for lastRefillAt * fix: better naming for last refill time and refill duration * fix: use nanosecond precision - update changelog - add benchmarks - rename variables - rename package * feat: run bench in gh actions
- Loading branch information
1 parent
1dbf7ca
commit 0e9cd14
Showing
8 changed files
with
101 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.PHONY: test build lint fmt | ||
.PHONY: test bench build lint fmt | ||
|
||
lint := go run github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
|
@@ -22,3 +22,7 @@ lint: | |
test: | ||
@echo "Running tests..." | ||
go test -v -race ./... | ||
|
||
bench: | ||
@echo "Running benchmarks..." | ||
go test -bench=. -count 5 -run=^# ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ratelimiter | ||
package ratelimit | ||
|
||
type Opt func(r *RateLimiter) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters