]> granicus.if.org Git - neomutt/commitdiff
Change imap body cache cleanup to use the uid_hash.
authorKevin McCarthy <kevin@8t8.us>
Wed, 24 May 2017 22:46:41 +0000 (15:46 -0700)
committerRichard Russon <rich@flatcap.org>
Wed, 24 May 2017 23:46:55 +0000 (00:46 +0100)
This should speed up $message_cache_clean cleanup when syncing.

imap/message.c

index 5d79a6c7b15eb2cf01ab57ab426a08cf1b627cda..27eb6b29ec432b2e7f2043403147b48a0366ad57 100644 (file)
@@ -125,17 +125,9 @@ static int msg_cache_clean_cb(const char *id, struct BodyCache *bcache, void *da
     return 0;
 
   /* bad UID */
-  if (uv != idata->uid_validity)
+  if (uv != idata->uid_validity || !int_hash_find(idata->uid_hash, uid))
     mutt_bcache_del(bcache, id);
 
-  /* TODO: presort UIDs, walk in order */
-  for (unsigned int n = 0; n < idata->ctx->msgcount; n++)
-  {
-    if (uid == HEADER_DATA(idata->ctx->hdrs[n])->uid)
-      return 0;
-  }
-  mutt_bcache_del(bcache, id);
-
   return 0;
 }