Branch 'dev/kolab-cache-refactoring' - plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Mon Oct 7 14:32:11 CEST 2013


 plugins/libkolab/lib/kolab_storage_cache.php |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 4f69556b7165fcf09d49c7b77a0f97ab6f1a0cc6
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Mon Oct 7 14:31:48 2013 +0200

    Only set sync lock if folder hash changed

diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 589b809..6a3e0d6 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();
     }




More information about the commits mailing list