lib/kolab_sync_data_email.php
Aleksander Machniak
machniak at kolabsys.com
Fri Oct 18 15:45:03 CEST 2013
lib/kolab_sync_data_email.php | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
New commits:
commit 46c714946740c8e95a9f4882b727e16ff0e24697
Author: Aleksander Machniak <alec at alec.pl>
Date: Fri Oct 18 15:44:35 2013 +0200
Improve performance by skipping IMAP SEARCH when checking mail folder for changes (Bug #2386)
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index 6822f54..18b8b54 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -802,22 +802,39 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
// We're in "get changes" mode
if (isset($modseq_data)) {
$folder_data = $this->storage->folder_data($foldername);
+ $got_changes = true;
+
if ($folder_data['HIGHESTMODSEQ']) {
$modseq_data[$foldername] = $folder_data['HIGHESTMODSEQ'];
if ($modseq_data[$foldername] != $modseq[$foldername]) {
$modseq_update = true;
}
+ else {
+ $got_changes = false;
+ }
}
// If previous HIGHESTMODSEQ doesn't exist we can't get changes
// We can only get folder's HIGHESTMODSEQ value and store it for the next try
- if (empty($modseq) || empty($modseq[$foldername])) {
+ // Skip search if HIGHESTMODSEQ didn't change
+ if (!$got_changes || empty($modseq) || empty($modseq[$foldername])) {
continue;
}
$filter_str .= " MODSEQ " . ($modseq[$foldername] + 1);
}
+ // We could use messages cache by replacing search() with index()
+ // in some cases. This however is possible only if user has skip_deleted=true,
+ // in his Roundcube preferences, otherwise we'd make often cache re-initialization,
+ // because Roundcube message cache can work only with one skip_deleted
+ // setting at a time. We'd also need to make sure folder_sync() was called
+ // before (see above).
+ //
+ // if ($filter_str == 'ALL UNDELETED')
+ // $search = $this->storage->index($foldername, null, null, true, true);
+ // else
+
$search = $this->storage->search_once($foldername, $filter_str);
if (!($search instanceof rcube_result_index)) {
@@ -887,8 +904,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
continue;
}
-// $this->storage->set_folder($foldername);
- $this->storage->folder_sync($foldername);
+// $this->storage->set_folder($foldername);
+// $this->storage->folder_sync($foldername);
$search = $this->storage->search_once($foldername, $search_str);
More information about the commits
mailing list