]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Wait for lock in cache compression, not just try once
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 31 Mar 2020 15:53:33 +0000 (18:53 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:43 +0000 (12:41 +0300)
Sometimes there's an important reason for the cache to be compressed, and it
shouldn't give up just because there's a race condition with another process
that just happens to be writing to it.

src/lib-index/mail-cache-compress.c

index 127059251e31aa657779a2f375b306d05148d774..b1a358cf8422bc7e0a4eaf6cc3987a4f501acb99 100644 (file)
@@ -495,9 +495,9 @@ mail_cache_compress_full(struct mail_cache *cache,
           the same time, but locking the cache file itself prevents other
           processes from doing other changes to it (header changes, adding
           more cached data). */
-       switch (mail_cache_try_lock(cache)) {
+       switch (mail_cache_lock(cache)) {
        case -1:
-               /* already locked or some other error */
+               /* lock timeout or some other error */
                return -1;
        case 0:
                /* cache is broken or doesn't exist.