From 04ccbd09b1f9369949b89b4815752d08a0ca9786 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 30 Jul 2019 15:12:15 -0400 Subject: Clean maildirs when opened This removes old aborted deliveries from the tmp directory. --- worker/maildir/worker.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'worker') diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index aa54af5..533bb7c 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -202,6 +202,10 @@ func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error { return fmt.Errorf("could not add watch to directory: %v", err) } + if err := dir.Clean(); err != nil { + return fmt.Errorf("could not clean directory: %v", err) + } + // TODO: why does this need to be sent twice?? info := &types.DirectoryInfo{ Info: &models.DirectoryInfo{ -- cgit v1.2.3