From 0f41388bd78668ceae6d5c12b05868bd0ca8fd1f Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Sat, 29 Mar 2025 23:24:06 -0400 Subject: Add periodic cleanup job for DecayMap (#8) (#158) * Add periodic cleanup job for DecayMap see https://github.com/TecharoHQ/anubis/issues/8 * Refactor: Improve DecayMap cleanup tests and add Len method - Refactored DecayMap cleanup tests to use the new Len method for more precise assertions. - Added a Len method to DecayMap to retrieve the number of entries. - Simplified conditional checks in Get method. * chore(changelog): add entry * fix(tests): Use Impl.expire for decaymap cleanup Signed-off-by: Jason Cameron --------- Signed-off-by: Jason Cameron --- lib/anubis.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/anubis.go b/lib/anubis.go index 114356c..c61b110 100644 --- a/lib/anubis.go +++ b/lib/anubis.go @@ -529,3 +529,7 @@ func (s *Server) checkRemoteAddress(b policy.Bot, addr net.IP) bool { return ok } + +func (s *Server) CleanupDecayMap() { + s.DNSBLCache.Cleanup() +} -- cgit v1.2.3