Only set sync lock if folder hash changed

This commit is contained in:
Thomas Bruederli 2013-10-07 14:31:48 +02:00
parent 20d6aa265c
commit 4f69556b71

View file

@ -128,12 +128,15 @@ class kolab_storage_cache
// increase time limit // increase time limit
@set_time_limit($this->max_sync_lock_time); @set_time_limit($this->max_sync_lock_time);
// lock synchronization for this folder or wait if locked // read cached folder metadata
$this->_sync_lock(); $this->_read_folder_data();
// check cache status hash first ($this->metadata is set in _read_folder_data()) // check cache status hash first ($this->metadata is set in _read_folder_data())
if ($this->metadata['ctag'] != $this->folder->get_ctag()) { if ($this->metadata['ctag'] != $this->folder->get_ctag()) {
// lock synchronization for this folder or wait if locked
$this->_sync_lock();
// synchronize IMAP mailbox cache // synchronize IMAP mailbox cache
$this->imap->folder_sync($this->folder->name); $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()) // update ctag value (will be written to database in _sync_unlock())
$this->metadata['ctag'] = $this->folder->get_ctag(); $this->metadata['ctag'] = $this->folder->get_ctag();
} }
}
// remove lock // remove lock
$this->_sync_unlock(); $this->_sync_unlock();
}
$this->synched = time(); $this->synched = time();
} }