Commit ce964911 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-783 Catch StatusException when loading conflicts.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 16ad9d52
...@@ -311,17 +311,23 @@ class ImportChangesICS implements IImportChanges { ...@@ -311,17 +311,23 @@ class ImportChangesICS implements IImportChanges {
$potConflicts = $exporter->GetChangeCount(); $potConflicts = $exporter->GetChangeCount();
$started = time(); $started = time();
$exported = 0; $exported = 0;
while(is_array($exporter->Synchronize())) { try {
$exported++; while(is_array($exporter->Synchronize())) {
$exported++;
// stop if this takes more than 15 seconds and there are more than 5 changes still to be exported
// within 20 seconds this should be finished or it will not be performed // stop if this takes more than 15 seconds and there are more than 5 changes still to be exported
if ((time() - $started) > 15 && ($potConflicts - $exported) > 5 ) { // within 20 seconds this should be finished or it will not be performed
ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection cancelled as operation is too slow. In %d seconds only %d from %d changes were processed.",(time() - $started), $exported, $potConflicts)); if ((time() - $started) > 15 && ($potConflicts - $exported) > 5 ) {
$this->conflictsLoaded = true; ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): conflict detection cancelled as operation is too slow. In %d seconds only %d from %d changes were processed.",(time() - $started), $exported, $potConflicts));
return; $this->conflictsLoaded = true;
return;
}
} }
} }
// something really bad happened while exporting changes
catch (StatusException $stex) {
ZLog::Write(LOGLEVEL_WARN, sprintf("ImportChangesICS->lazyLoadConflicts(): got StatusException code %d while exporting changes. Ignoring and mark conflicts as loaded.",$stex->getCode()));
}
$this->conflictsLoaded = true; $this->conflictsLoaded = true;
} }
} }
......
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