From 24083421e4a38b1dbca6f0f593aaecae8f4f57ec Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 21 Sep 2018 22:27:10 +0200 Subject: loop_reconnect: Ignore incomplete FETCH lines when dovecot dies Signed-off-by: Florian Pritz --- lib/App/ImapNotify.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/App/ImapNotify.pm b/lib/App/ImapNotify.pm index cbdc4ac..1781c86 100644 --- a/lib/App/ImapNotify.pm +++ b/lib/App/ImapNotify.pm @@ -75,7 +75,12 @@ method loop_reconnect() { try { $self->loop(); } catch { - die $@ unless $@ =~ m/^Lost connection while .*/; + sub { + return if $@ =~ m/^Lost connection while .*/; + # dovecot crashes somtimes during fetching and sends an incomplete fetch response + return if $@ =~ m/^First line doesn't match FETCH pattern./; + die $@; + }->(); } $holdoff_repeat = 0 if (time - $last_time) > $holdoff_limit; sleep($holdoff_time * $holdoff_repeat++); -- cgit v1.2.3-24-g4f1b