Skip to content

Commit

Permalink
🩹 Fix limiter middleware db connection (#1813)
Browse files Browse the repository at this point in the history
* remove release() method

* Revert "remove release() method"

This reverts commit fdfc8da.

* Rearrange mutexes in limiter_fixed.go

* refactor limiter_fixed.go

* Update limiter_fixed.go

Co-authored-by: RW <rene@gofiber.io>
  • Loading branch information
kwarabei and ReneWerner87 committed Mar 15, 2022
1 parent bd20e90 commit c92a505
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions middleware/limiter/limiter_fixed.go
Expand Up @@ -92,9 +92,13 @@ func (FixedWindow) New(cfg Config) fiber.Handler {
// Check for SkipFailedRequests and SkipSuccessfulRequests
if (cfg.SkipSuccessfulRequests && c.Response().StatusCode() < fiber.StatusBadRequest) ||
(cfg.SkipFailedRequests && c.Response().StatusCode() >= fiber.StatusBadRequest) {
// Lock entry
mux.Lock()
e = manager.get(key)
e.currHits--
remaining++
manager.set(key, e, cfg.Expiration)
// Unlock entry
mux.Unlock()
}

Expand Down

1 comment on commit c92a505

@Fenny
Copy link
Member

@Fenny Fenny commented on c92a505 Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: c92a505 Previous: bd20e90 Ratio
Benchmark_App_ETag 11498 ns/op 1044 B/op 3 allocs/op 5479 ns/op 1044 B/op 3 allocs/op 2.10

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.