From 4106da56d10a820501093c07a82d8c8e980007f5 Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Thu, 5 Mar 2015 18:34:13 -0600 Subject: [PATCH] Don't leave DB locked after pruning an empty DB --- plugins/greylisting | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/greylisting b/plugins/greylisting index 12926a2..72b04f2 100644 --- a/plugins/greylisting +++ b/plugins/greylisting @@ -502,7 +502,7 @@ sub prune_db { my @to_delete; my $greylist = {}; - my @keys = $self->db->get_keys or return; + my @keys = $self->db->get_keys or return $self->db->unlock; @$greylist{ @keys } = ( $self->db->mget(@keys) ); for my $key ( @keys ) { my ($ts) = split /:/, delete $greylist->{$key}; @@ -510,7 +510,7 @@ sub prune_db { next if $age < $self->{_args}{white_timeout}; push @to_delete, $key; } - return if ! @to_delete; + return $self->db->unlock if ! @to_delete; my $pruned = $self->db->delete(@to_delete); $self->db->unlock; $self->log(LOGINFO, "pruned $pruned of $count DB entries");