From c2b779397f79840a61e70c522c9611aaf86da7ca Mon Sep 17 00:00:00 2001 From: Cyberes Date: Tue, 17 Sep 2024 21:53:42 -0600 Subject: [PATCH] fix archiver selecting oldest timestamp in database, fix systemd --- iarchiver/database.py | 2 +- systemd/imaparchiver.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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]