diff --git a/iarchiver/database.py b/iarchiver/database.py index cfab463..dd02b79 100644 --- a/iarchiver/database.py +++ b/iarchiver/database.py @@ -76,7 +76,7 @@ class EmailDatabase: def have_we_done_a_full_sync_at_all(self): cursor = self.conn.cursor() - cursor.execute("SELECT * FROM syncs ORDER BY timestamp LIMIT 1") + cursor.execute("SELECT * FROM syncs ORDER BY timestamp DESC LIMIT 1") row = cursor.fetchone() cursor.close() if row is not None: diff --git a/systemd/imaparchiver.service b/systemd/imaparchiver.service index c6097a0..4259753 100644 --- a/systemd/imaparchiver.service +++ b/systemd/imaparchiver.service @@ -8,7 +8,7 @@ User=emailsync Group=emailsync ExecStart=/srv/email/imap-archiver/venv/bin/python3 /srv/email/imap-archiver/run.py --config /srv/email/imap-archiver/config.yml SyslogIdentifier=imap-archiver -Restart=always +Restart=on-failure WatchdogSec=600 [Install]