about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-07-30 15:12:15 -0400
committerDrew DeVault <sir@cmpwn.com>2019-08-02 09:26:07 -0400
commit04ccbd09b1f9369949b89b4815752d08a0ca9786 (patch)
tree0cdf4ab0f5545c8ab02b2955c53479a7d134a5b8
parentbfefafff27b126c485054c4d357e095ea2bd1147 (diff)
downloadaerc-04ccbd09b1f9369949b89b4815752d08a0ca9786.tar.gz
Clean maildirs when opened
This removes old aborted deliveries from the tmp directory.
-rw-r--r--worker/maildir/worker.go4
1 files changed, 4 insertions, 0 deletions
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{