Commit 5f7d4562 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #149 in ZP/z-push from feature/ZP-832-detect-folder-changes-faster to develop

* commit '8ce686c1':
  ZP-832 Directly compare GlobalWindowSize and globallyExportedItems.
  ZP-832 Check for availability in GlobalWindowSize first before comparing folder stats, do folderstats comparing only if there is space in GlobalWindowSize, do not ommit output if folder has no stat.
parents 7cdb51e4 8ce686c1
...@@ -701,8 +701,14 @@ class Sync extends RequestProcessor { ...@@ -701,8 +701,14 @@ class Sync extends RequestProcessor {
// TODO we could check against $sc->GetChangedFolderIds() on heartbeat so we do not need to configure all exporter again // TODO we could check against $sc->GetChangedFolderIds() on heartbeat so we do not need to configure all exporter again
if($status == SYNC_STATUS_SUCCESS && ($sc->GetParameter($spa, "getchanges") || ! $spa->HasSyncKey())) { if($status == SYNC_STATUS_SUCCESS && ($sc->GetParameter($spa, "getchanges") || ! $spa->HasSyncKey())) {
// no need to run the exporter if the globalwindowsize is already full
if ($sc->GetGlobalWindowSize() == $this->globallyExportedItems) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Sync(): no exporter setup for '%s' as GlobalWindowSize is full.", $spa->GetFolderId()));
$setupExporter = false;
}
// compare the folder statistics if the backend supports this // compare the folder statistics if the backend supports this
if (self::$backend->HasFolderStats()) { if ($setupExporter && self::$backend->HasFolderStats() && $spa->HasFolderStat()) {
// check if the folder stats changed -> if not, don't setup the exporter, there are no changes! // check if the folder stats changed -> if not, don't setup the exporter, there are no changes!
$newFolderStat = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetFolderId()), $spa->GetFolderId()); $newFolderStat = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetFolderId()), $spa->GetFolderId());
if ($newFolderStat === $spa->GetFolderStat()) { if ($newFolderStat === $spa->GetFolderStat()) {
...@@ -712,12 +718,6 @@ class Sync extends RequestProcessor { ...@@ -712,12 +718,6 @@ class Sync extends RequestProcessor {
} }
} }
// no need to run the exporter if the globalwindowsize is already full
if ($sc->GetGlobalWindowSize() - $this->globallyExportedItems == 0) {
ZLog::Write(LOGLEVEL_DEBUG, "Sync(): no exporter setup as GlobalWindowSize is full.");
$setupExporter = false;
}
// Do a full Exporter setup if we can't avoid it // Do a full Exporter setup if we can't avoid it
if ($setupExporter) { if ($setupExporter) {
//make sure the states are loaded //make sure the states are loaded
...@@ -795,7 +795,8 @@ class Sync extends RequestProcessor { ...@@ -795,7 +795,8 @@ class Sync extends RequestProcessor {
} }
// Fir AS 14.0+ omit output for folder, if there were no incoming or outgoing changes and no Fetch // Fir AS 14.0+ omit output for folder, if there were no incoming or outgoing changes and no Fetch
if (Request::GetProtocolVersion() >= 14.0 && ! $spa->HasNewSyncKey() && $changecount == 0 && empty($actiondata["fetchids"]) && $status == SYNC_STATUS_SUCCESS && $spa->GetFolderStat() === $newFolderStat) { if (Request::GetProtocolVersion() >= 14.0 && ! $spa->HasNewSyncKey() && $changecount == 0 && empty($actiondata["fetchids"]) && $status == SYNC_STATUS_SUCCESS &&
$spa->HasFolderStat() && $spa->GetFolderStat() === $newFolderStat) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync: No changes found for %s folder id '%s'. Omitting output.", $spa->GetContentClass(), $spa->GetFolderId())); ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync: No changes found for %s folder id '%s'. Omitting output.", $spa->GetContentClass(), $spa->GetFolderId()));
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment