Re: Avoiding the "huge INBOX of death"
authorVladimir Marek <Vladimir.Marek@oracle.com>
Tue, 19 Jul 2016 10:36:11 +0000 (12:36 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:14 +0000 (16:22 -0700)
97/c3796b213d5d6f5d1f08100b4806162f666819 [new file with mode: 0644]

diff --git a/97/c3796b213d5d6f5d1f08100b4806162f666819 b/97/c3796b213d5d6f5d1f08100b4806162f666819
new file mode 100644 (file)
index 0000000..65803ef
--- /dev/null
@@ -0,0 +1,136 @@
+Return-Path: <Vladimir.Marek@oracle.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 371C76DE015B\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jul 2016 03:52:02 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.096\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.096 tagged_above=-999 required=5 tests=[AWL=2.214,\r
+  RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01,\r
+ UNPARSEABLE_RELAY=0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 0MieoV6E8xKD for <notmuch@notmuchmail.org>;\r
+ Tue, 19 Jul 2016 03:51:54 -0700 (PDT)\r
+X-Greylist: delayed 935 seconds by postgrey-1.35 at arlo;\r
+ Tue, 19 Jul 2016 03:51:54 PDT\r
+Received: from userp1050.oracle.com (userp1050.oracle.com [156.151.31.82])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 08F8B6DE012F\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jul 2016 03:51:53 -0700 (PDT)\r
+Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81])\r
+ by userp1050.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id\r
+ u6JAaKk0000382\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jul 2016 10:36:20 GMT\r
+Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234])\r
+ by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id\r
+ u6JAaGRf014460\r
+ (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
+ Tue, 19 Jul 2016 10:36:17 GMT\r
+Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])\r
+ by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u6JAaG1C002107\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
+ Tue, 19 Jul 2016 10:36:16 GMT\r
+Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24])\r
+ by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u6JAaFRe004424;\r
+ Tue, 19 Jul 2016 10:36:15 GMT\r
+Received: from virtual.cz.oracle.com (/10.163.86.11)\r
+ by default (Oracle Beehive Gateway v4.0)\r
+ with ESMTP ; Tue, 19 Jul 2016 03:36:14 -0700\r
+Date: Tue, 19 Jul 2016 12:36:11 +0200\r
+From: Vladimir Marek <Vladimir.Marek@oracle.com>\r
+To: "=?utf-8?Q?Rapha=C3=ABl?= Fournier-S'niehotta"\r
+ <raphael@raphaelfournier.net>\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: Avoiding the "huge INBOX of death"\r
+Message-ID: <20160719103610.GB972@virtual.cz.oracle.com>\r
+References: <20160719094205.qmf5sjnja6crt5t3@gotlib>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+In-Reply-To: <20160719094205.qmf5sjnja6crt5t3@gotlib>\r
+User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16)\r
+X-Source-IP: userp1040.oracle.com [156.151.31.81]\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 19 Jul 2016 10:52:02 -0000\r
+\r
+I can't speak for everyone, but here's what I am using.\r
+\r
+I do have 'messages' directory which contains 'imap' and 'archive'.\r
+\r
+messages\r
+ \-imap\r
+ \-archive\r
+\r
+The imap directory is being synchronized via offlineimap to the server.\r
+\r
+In the offlineimap postsync hook I call a script which does some\r
+bookkeeping on the newly received messages and it also marks old and\r
+already read and not flagged emails by the 'old-tread' tag.\r
+\r
+N=notmuch\r
+while : ; do\r
+   AGE=100d # 100 days\r
+   # Find all threads containing old messages\r
+   OLD_MESSAGES=$( $N search --output=threads not tag:archive and date:..$AGE and not tag:unread and not tag:flagged )\r
+   [ -n "$OLD_MESSAGES" ] || break\r
+   # Find threads containing newer messages\r
+   NEW_MESSAGES=$( $N search --output=threads not tag:archive and not '(' date:..$AGE or tag:unread or tag:flagged ')' )\r
+   # remove the threads containing newer messages\r
+   OLD_THREADS=$( /usr/xpg4/bin/fgrep -v -x -f <(echo "$NEW_MESSAGES") < <(echo "$OLD_MESSAGES") )\r
+   [ -n "$OLD_THREADS" ] || break\r
+   $N tag +old-thread -- $OLD_THREADS\r
+   break\r
+done\r
+\r
+# If old thread received newer message, unmark it too\r
+$N tag -old-thread -- tag:old-thread and '(' not date:..$AGE or tag:unread or tag:flagged or tag:archive ')'\r
+\r
+\r
+Once in a while I review the old-thread messages and assign them by hand\r
+'archive' flag. The postsync hook is looking for this flag and moves all\r
+messages to be archived into archive folder. You can list files to be\r
+archived by\r
+\r
+$N search --output=files 'path:imap/**' tag:archive\r
+\r
+I won't list the commands to move files from messages/imap to\r
+messages/archive since I have a bit more complex scenario. But it should\r
+be straightforward.\r
+\r
+On next run offlineimap sees that the messages disappeared from 'imap'\r
+folder and removes them from imap server.\r
+\r
+$ notmuch count '*'\r
+734346\r
+$ notmuch count 'path:imap/**'\r
+18419\r
+\r
+\r
+In my case I am server side filtering the emails into several folders so\r
+that I have at least some order in emails when reading email via phone,\r
+so 'path:imap/**' contains all the messages in whole imap tree.\r
+\r
+$ notmuch count 'path:imap/** and tag:inbox and tag:unread'\r
+11\r
+\r
+I'm trying to have my virtual INBOX empty most of the time.\r
+\r
+I'm interested what tricks others use!\r
+Cheers\r
+-- \r
+       Vlad\r