From 95fe217ce1b4c9df36c6a30d6e56477b315b84c9 Mon Sep 17 00:00:00 2001 From: hunter-nl Date: Sat, 4 May 2019 11:58:19 +0200 Subject: [PATCH] Update imapsync_cron.pl Fix: Reset is_running status in case of exception occurs in running imapsync. Else it will stuck in "running" status. --- data/Dockerfiles/dovecot/imapsync_cron.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/Dockerfiles/dovecot/imapsync_cron.pl b/data/Dockerfiles/dovecot/imapsync_cron.pl index f9e53bf3..01cd0ad8 100755 --- a/data/Dockerfiles/dovecot/imapsync_cron.pl +++ b/data/Dockerfiles/dovecot/imapsync_cron.pl @@ -140,12 +140,17 @@ while ($row = $sth->fetchrow_arrayref()) { $update->bind_param( 2, ${id} ); $update->execute(); } catch { - $update = $dbh->prepare("UPDATE imapsync SET returned_text = 'Could not start or finish imapsync', last_run = NOW(), is_running = 0 WHERE id = ?"); + $update = $dbh->prepare("UPDATE imapsync SET returned_text = 'Could not start or finish imapsync' WHERE id = ?"); + $update->bind_param( 1, ${id} ); + $update->execute(); + } finally { + $update = $dbh->prepare("UPDATE imapsync SET last_run = NOW(), is_running = 0 WHERE id = ?"); $update->bind_param( 1, ${id} ); $update->execute(); $lockmgr->unlock($lock_file); }; + } $sth->finish();