Commit 1f795b8b authored by skummer's avatar skummer

ZP-237 #comment set folderstatus to complete after last chunk of messages was...

ZP-237 #comment set folderstatus to complete after last chunk of messages was sent and make sure to consider only a changes count retrieved from ICS #time 2h

git-svn-id: https://z-push.org/svn/z-push/trunk@1629 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 2c39fe8f
......@@ -585,8 +585,9 @@ class Sync extends RequestProcessor {
try {
// if doing an empty sync, check only once for changes
if ($emptysync) {
$foundchanges = $sc->CountChanges();
$foundchanges = $sc->CountChanges();
}
// wait for changes
else {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Entering Heartbeat mode"));
......@@ -653,7 +654,7 @@ class Sync extends RequestProcessor {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): partial sync for folder class '%s' with id '%s'", $spa->GetContentClass(), $spa->GetFolderId()));
// initialize exporter to get changecount
$changecount = 0;
$changecount = false;
if (isset($exporter))
unset($exporter);
......@@ -697,8 +698,10 @@ class Sync extends RequestProcessor {
self::$topCollector->AnnounceInformation(sprintf("Exporter registered. %d objects queued.", $changecount), true);
// update folder status as initialized
$spa->SetFolderSyncTotal($changecount);
if ($changecount > 0)
$spa->SetFolderSyncRemaining($changecount);
if ($changecount > 0) {
self::$deviceManager->SetFolderSyncStatus($folderid, DeviceManager::FLD_SYNC_INITIALIZED);
}
}
else if ($status != SYNC_STATUS_SUCCESS)
self::$topCollector->AnnounceInformation(sprintf("StatusException code: %d", $status), true);
......@@ -902,7 +905,8 @@ class Sync extends RequestProcessor {
// update folder status
$spa->SetFolderSyncRemaining($changecount);
if ($changecount == 0)
// changecount is initialized with 'false', so 0 means no changes!
if ($changecount === 0 || ($changecount !== false && $changecount <= $windowSize))
self::$deviceManager->SetFolderSyncStatus($folderid, DeviceManager::FLD_SYNC_COMPLETED);
else
self::$deviceManager->SetFolderSyncStatus($folderid, DeviceManager::FLD_SYNC_INPROGRESS);
......
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