From 4f69556b7165fcf09d49c7b77a0f97ab6f1a0cc6 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 7 Oct 2013 14:31:48 +0200 Subject: [PATCH] Only set sync lock if folder hash changed --- plugins/libkolab/lib/kolab_storage_cache.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index 589b8095..6a3e0d6a 100644 --- a/plugins/libkolab/lib/kolab_storage_cache.php +++ b/plugins/libkolab/lib/kolab_storage_cache.php @@ -128,12 +128,15 @@ class kolab_storage_cache // increase time limit @set_time_limit($this->max_sync_lock_time); - // lock synchronization for this folder or wait if locked - $this->_sync_lock(); + // read cached folder metadata + $this->_read_folder_data(); // check cache status hash first ($this->metadata is set in _read_folder_data()) if ($this->metadata['ctag'] != $this->folder->get_ctag()) { + // lock synchronization for this folder or wait if locked + $this->_sync_lock(); + // synchronize IMAP mailbox cache $this->imap->folder_sync($this->folder->name); @@ -176,10 +179,10 @@ class kolab_storage_cache // update ctag value (will be written to database in _sync_unlock()) $this->metadata['ctag'] = $this->folder->get_ctag(); } - } - // remove lock - $this->_sync_unlock(); + // remove lock + $this->_sync_unlock(); + } $this->synched = time(); }