diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-22 16:10:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-22 16:10:20 +0100 |
commit | c36131d2bd53707f71ad9c63875db5d506f3b45f (patch) | |
tree | 8d0ff8a7d44f8c865f8d59b5df23a68a6029e2bb | |
parent | d814e862c3e34199c77134c27105c08bd975e178 (diff) | |
download | rspamd-c36131d2bd53707f71ad9c63875db5d506f3b45f.tar.gz rspamd-c36131d2bd53707f71ad9c63875db5d506f3b45f.zip |
[Fix] Fix eviction corner case
Issue: #2991
-rw-r--r-- | src/libutil/hash.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/hash.c b/src/libutil/hash.c index 56e80a17e..09d3a29c1 100644 --- a/src/libutil/hash.c +++ b/src/libutil/hash.c @@ -481,6 +481,10 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now) } } }); + + if (selected) { + elt = selected; + } } else { /* Fast random eviction */ @@ -493,6 +497,7 @@ rspamd_lru_hash_evict (rspamd_lru_hash_t *hash, time_t now) } } + /* Evict if nothing else has been cleaned */ if (elt && nexpired == 0) { rspamd_lru_hash_remove_node (hash, elt); } |