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