Commit 09d36fca authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #385 in ZP/z-push from...

Merge pull request #385 in ZP/z-push from bugfix/ZP-1047-moveitems-operation-writes-too-long to develop

* commit '7b9ae573':
  ZP-1047 Count the elements to be moved only once.
  ZP-1047 Better logging when moving large amounts of messages in one request.
parents 3bd6b016 7b9ae573
...@@ -86,7 +86,11 @@ class MoveItems extends RequestProcessor { ...@@ -86,7 +86,11 @@ class MoveItems extends RequestProcessor {
self::$encoder->startTag(SYNC_MOVE_MOVES); self::$encoder->startTag(SYNC_MOVE_MOVES);
$operationResults = array();
$operationCounter = 0;
$operationTotal = count($moves);
foreach($moves as $move) { foreach($moves as $move) {
$operationCounter++;
self::$encoder->startTag(SYNC_MOVE_RESPONSE); self::$encoder->startTag(SYNC_MOVE_RESPONSE);
self::$encoder->startTag(SYNC_MOVE_SRCMSGID); self::$encoder->startTag(SYNC_MOVE_SRCMSGID);
self::$encoder->content($move["srcmsgid"]); self::$encoder->content($move["srcmsgid"]);
...@@ -141,7 +145,15 @@ class MoveItems extends RequestProcessor { ...@@ -141,7 +145,15 @@ class MoveItems extends RequestProcessor {
$status = $stex->getCode(); $status = $stex->getCode();
} }
self::$topCollector->AnnounceInformation(sprintf("Operation status: %s", $status), true); if ($operationCounter % 10 == 0) {
self::$topCollector->AnnounceInformation(sprintf("Moved %d objects out of %d", $operationCounter, $operationTotal));
}
// save the operation result
if (!isset($operationResults[$status])) {
$operationResults[$status] = 0;
}
$operationResults[$status]++;
self::$encoder->startTag(SYNC_MOVE_STATUS); self::$encoder->startTag(SYNC_MOVE_STATUS);
self::$encoder->content($status); self::$encoder->content($status);
...@@ -153,6 +165,12 @@ class MoveItems extends RequestProcessor { ...@@ -153,6 +165,12 @@ class MoveItems extends RequestProcessor {
self::$encoder->endTag(); self::$encoder->endTag();
} }
self::$topCollector->AnnounceInformation(sprintf("Moved %d - Codes", $operationTotal), true);
foreach ($operationResults as $status => $occurences) {
self::$topCollector->AnnounceInformation(sprintf("%dx%d", $occurences, $status), true);
}
self::$encoder->endTag(); self::$encoder->endTag();
return true; return 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