diff --git a/decaymap/decaymap.go b/decaymap/decaymap.go index 37997e1..5fe9572 100644 --- a/decaymap/decaymap.go +++ b/decaymap/decaymap.go @@ -146,7 +146,7 @@ func (m *Impl[K, V]) Close() { func (m *Impl[K, V]) cleanupWorker() { defer m.wg.Done() batch := make([]deleteReq[K], 0, 64) - ticker := time.NewTicker(10 * time.Millisecond) + ticker := time.NewTicker(500 * time.Millisecond) defer ticker.Stop() flush := func() { diff --git a/decaymap/decaymap_test.go b/decaymap/decaymap_test.go index e9bc824..887ca00 100644 --- a/decaymap/decaymap_test.go +++ b/decaymap/decaymap_test.go @@ -32,7 +32,7 @@ func TestImpl(t *testing.T) { // Deletion of expired entries after Get is deferred to a background worker. // Assert it eventually disappears from the map. - deadline := time.Now().Add(200 * time.Millisecond) + deadline := time.Now().Add(700 * time.Millisecond) for time.Now().Before(deadline) { if dm.Len() == 0 { break diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index 175e001..e74efae 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add iplist2rule tool that lets admins turn an IP address blocklist into an Anubis ruleset. - Add Polish locale ([#1292](https://github.com/TecharoHQ/anubis/pull/1309)) - Fix honeypot and imprint links missing `BASE_PREFIX` when deployed behind a path prefix ([#1402](https://github.com/TecharoHQ/anubis/issues/1402)) +- Improve idle performance in memory storage