From 3c6c1775ff1baaa7b3bf50aa1d9646d25e957706 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 20 Aug 2015 19:11:36 +0200 Subject: Unconditionally restart the systemd service. It's unfortunate in that the service keep restarting every n secs in case the remote server is down. Ideally systemd would offer a way to restart services with a non-constant (e.g., exponential) progression in case of failure. --- imapsync.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imapsync.service b/imapsync.service index 725f23b..02b4d13 100644 --- a/imapsync.service +++ b/imapsync.service @@ -6,7 +6,7 @@ After=network-online.target [Service] ExecStart=/usr/bin/imapsync RestartSec=60s -Restart=on-success +Restart=always [Install] WantedBy=default.target -- cgit v1.2.3 From a5b7f9777acae2ad50a90e15db5936f190a507c2 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 1 Sep 2015 00:46:12 +0200 Subject: Compress "No match for vanished local/remote UID ..." warnings. --- imapsync | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/imapsync b/imapsync index a007089..f7c5234 100755 --- a/imapsync +++ b/imapsync @@ -727,8 +727,12 @@ sub repair($) { # Process UID found in IMAP but not in the mapping table. - msg("remote($mailbox)", "WARNING: No match for vanished local UID $_. Ignoring.") foreach keys %lVanished; - msg("local($mailbox)", "WARNING: No match for vanished remote UID $_. Ignoring.") foreach keys %rVanished; + my @lDunno = keys %lVanished; + my @rDunno = keys %rVanished; + msg("remote($mailbox)", "WARNING: No match for ".($#lDunno+1)." vanished local UID(s) " + .compact_set(@lDunno).". Ignoring.") if @lDunno; + msg("local($mailbox)", "WARNING: No match for ".($#rDunno+1)." vanished remote UID(s) " + .compact_set(@rDunno).". Ignoring.") if @rDunno; foreach my $lUID (keys %$lModified) { msg("remote($mailbox)", "WARNING: No match for modified local UID $lUID. Downloading again."); @@ -777,13 +781,13 @@ sub sync_known_messages($$) { # other side (from the DB); consider it as to be removed if # it hasn't been removed already. - my (@lToRemove, @rToRemove); + my (@lToRemove, @rToRemove, @lDunno, @rDunno); foreach my $lUID (@$lVanished) { $STH_GET_REMOTE_UID->execute($idx, $lUID); my ($rUID) = $STH_GET_REMOTE_UID->fetchrow_array(); die if defined $STH_GET_REMOTE_UID->fetchrow_arrayref(); # sanity check if (!defined $rUID) { - msg("remote($mailbox)", "WARNING: No match for vanished local UID $lUID. Ignoring."); + push @lDunno, $lUID; } elsif (!exists $rVanished{$rUID}) { push @rToRemove, $rUID; @@ -794,13 +798,18 @@ sub sync_known_messages($$) { my ($lUID) = $STH_GET_LOCAL_UID->fetchrow_array(); die if defined $STH_GET_LOCAL_UID->fetchrow_arrayref(); # sanity check if (!defined $lUID) { - msg("local($mailbox)", "WARNING: No match for vanished remote UID $rUID. Ignoring."); + push @rDunno, $rUID; } elsif (!exists $lVanished{$lUID}) { push @lToRemove, $lUID; } } + msg("remote($mailbox)", "WARNING: No match for ".($#lDunno+1)." vanished local UID(s) " + .compact_set(@lDunno).". Ignoring.") if @lDunno; + msg("local($mailbox)", "WARNING: No match for ".($#rDunno+1)." vanished remote UID(s) " + .compact_set(@rDunno).". Ignoring.") if @rDunno; + $lIMAP->remove_message(@lToRemove) if @lToRemove; $rIMAP->remove_message(@rToRemove) if @rToRemove; -- cgit v1.2.3