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
@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();
}