Commit 8cff4572 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-728 Use 512 as default WindowSize for a single folder, but limit the

GlobalWindowSize to the SYNC_MAX_ITEMS configured.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 81ad5685
...@@ -474,13 +474,7 @@ class DeviceManager { ...@@ -474,13 +474,7 @@ class DeviceManager {
if (isset($this->windowSize[$folderid])) if (isset($this->windowSize[$folderid]))
$items = $this->windowSize[$folderid]; $items = $this->windowSize[$folderid];
else else
$items = (defined("SYNC_MAX_ITEMS")) ? SYNC_MAX_ITEMS : 100; $items = 512;
if (defined("SYNC_MAX_ITEMS") && SYNC_MAX_ITEMS < $items) {
if ($queuedmessages > SYNC_MAX_ITEMS)
ZLog::Write(LOGLEVEL_DEBUG, sprintf("DeviceManager->GetWindowSize() overwriting max items requested of %d by %d forced in configuration.", $items, SYNC_MAX_ITEMS));
$items = SYNC_MAX_ITEMS;
}
$this->setLatestFolder($folderid); $this->setLatestFolder($folderid);
......
...@@ -330,17 +330,28 @@ class SyncCollections implements Iterator { ...@@ -330,17 +330,28 @@ class SyncCollections implements Iterator {
} }
/** /**
* Returns the global window size which should be used for all collections * Returns the global window size of items to be exported in total over all
* in a case of a heartbeat and/or partial sync * requested collections.
* *
* @access public * @access public
* @return int/boolean returns 512 (max) if not set or not available * @return int/boolean returns requested windows size, 512 (max) or the
* value of config SYNC_MAX_ITEMS if it is lower
*/ */
public function GetGlobalWindowSize() { public function GetGlobalWindowSize() {
if (!isset($this->globalWindowSize)) // take the requested global windowsize or the max 512 if not defined
return 512; if (isset($this->globalWindowSize)) {
$globalWindowSize = $this->globalWindowSize;
}
else {
$globalWindowSize = 512;
}
if (defined("SYNC_MAX_ITEMS") && SYNC_MAX_ITEMS < $globalWindowSize) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->GetGlobalWindowSize() overwriting requested global window size of %d by %d forced in configuration.", $globalWindowSize, SYNC_MAX_ITEMS));
$globalWindowSize = SYNC_MAX_ITEMS;
}
return $this->globalWindowSize; return $globalWindowSize;
} }
/** /**
......
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