Commit 69481e4f authored by skummer's avatar skummer

ZP-208 #comment possibility to limit max amount of synchronized items per config #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1469 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 48c066c2
......@@ -134,6 +134,13 @@
// SYNC_FILEAS_FIRSTLAST will be used
define('FILEAS_ORDER', SYNC_FILEAS_FIRSTLAST);
// Amount of items to be synchronized per request
// Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100.
// Exporting too much items can cause mobile timeout on busy systems.
// Z-Push will use the lowest value, either set here or by the mobile.
// default: 100 - value used if mobile does not limit amount of items
define('SYNC_MAX_ITEMS', 100);
/**********************************************************************************
* Backend settings
*/
......
......@@ -46,9 +46,6 @@
************************************************/
class DeviceManager {
// stream up to 100 messages to the client by default
const DEFAULTWINDOWSIZE = 100;
// broken message indicators
const MSG_BROKEN_UNKNOWN = 1;
const MSG_BROKEN_CAUSINGLOOP = 2;
......@@ -461,7 +458,13 @@ class DeviceManager {
if (isset($this->windowSize[$folderid]))
$items = $this->windowSize[$folderid];
else
$items = self::DEFAULTWINDOWSIZE;
$items = (defined("SYNC_MAX_ITEMS")) ? SYNC_MAX_ITEMS : 100;
if (defined("SYNC_MAX_ITEMS") && SYNC_MAX_ITEMS < $items) {
if ($queuedmessages > SYNC_MAX_ITEMS)
ZLog::Write(LOGLEVEL_DEBUG, sprintf("DeviceManager->GetWindowSize() overwriting max itmes requested of %d by %d forced in configuration.", $items, SYNC_MAX_ITEMS));
$items = SYNC_MAX_ITEMS;
}
$this->setLatestFolder($folderid);
......
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