From 36be9d357a198aced5df7360dbfd8b9ddcce1faf Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 13:45:01 +0200 Subject: [PATCH 1/6] Disable document cache --- src/Migration/Cache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index c0c4af97..d7ce2a26 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -42,6 +42,9 @@ public function add(Resource $resource): void if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { $status = $resource->getStatus(); $rowId = $resource->getSequence(); + + return; + $this->cache[$resource->getName()][$rowId] = $status; return; } From 17a7144cd0a07a1995a075ef8293a91a022f6a7b Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 13:51:03 +0200 Subject: [PATCH 2/6] Disable document cache --- src/Migration/Cache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index 0e3d1e05..1ba1cad3 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -90,6 +90,9 @@ public function add(Resource $resource): void $key = $this->resolveResourceCacheKey($resource); if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { $status = $resource->getStatus(); + + return; + $this->cache[$resource->getName()][$key] = $status; return; } From d6126f281a835ff5f32ceaca8ccef9f2841437a0 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 14:19:34 +0200 Subject: [PATCH 3/6] Put limit befor return --- src/Migration/Cache.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index 1ba1cad3..b496431f 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -91,7 +91,9 @@ public function add(Resource $resource): void if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { $status = $resource->getStatus(); - return; + if ((count($this->cache[$resource->getName()] ?? []) >= 10000)) { + return; // skip caching + } $this->cache[$resource->getName()][$key] = $status; return; From 71e867c45048d2b5925740a6cd9a732c4c4c409f Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 15:44:57 +0200 Subject: [PATCH 4/6] Skip Doc cache --- src/Migration/Cache.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index b496431f..6533e7a6 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -89,11 +89,10 @@ public function add(Resource $resource): void { $key = $this->resolveResourceCacheKey($resource); if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { - $status = $resource->getStatus(); - if ((count($this->cache[$resource->getName()] ?? []) >= 10000)) { - return; // skip caching - } + return; // skip caching + + $status = $resource->getStatus(); $this->cache[$resource->getName()][$key] = $status; return; From cf8797e62a8d9a6f309f386db9fea34a5f7fc415 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 16:44:31 +0200 Subject: [PATCH 5/6] count by status key --- src/Migration/Cache.php | 8 ++++++-- src/Migration/Transfer.php | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index 6533e7a6..8f6dd10a 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -89,10 +89,14 @@ public function add(Resource $resource): void { $key = $this->resolveResourceCacheKey($resource); if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { + $status = $resource->getStatus(); - return; // skip caching + $counter = $this->cache[$resource->getName()][$status] ?? 0; + $counter = intval($counter) + 1; - $status = $resource->getStatus(); + $this->cache[$resource->getName()][$status] = $counter . ''; // Transfer.php check is_string($resource) + + return; $this->cache[$resource->getName()][$key] = $status; return; diff --git a/src/Migration/Transfer.php b/src/Migration/Transfer.php index 2bcceef1..89d4dfdf 100644 --- a/src/Migration/Transfer.php +++ b/src/Migration/Transfer.php @@ -172,13 +172,14 @@ public function getStatusCounters(): array } foreach ($this->cache->getAll() as $resourceType => $resources) { - foreach ($resources as $resource) { + foreach ($resources as $k => $resource) { if (($resourceType === Resource::TYPE_ROW || $resourceType === Resource::TYPE_DOCUMENT) && is_string($resource)) { - $rowStatus = $resource; - $status[$resourceType][$rowStatus]++; + $resource = intval($resource); + + $status[$resourceType][$k] = $resource; if ($status[$resourceType]['pending'] > 0) { - $status[$resourceType]['pending']--; + $status[$resourceType]['pending'] -= $resource; } continue; From 3878554b4849538c5b3a6a01425f0f7cc13d5142 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 4 Dec 2025 17:01:36 +0200 Subject: [PATCH 6/6] Update cache --- src/Migration/Cache.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index 8f6dd10a..9a1902db 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -88,6 +88,7 @@ public function resolveResourceCacheKey(Resource $resource): string public function add(Resource $resource): void { $key = $this->resolveResourceCacheKey($resource); + if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { $status = $resource->getStatus(); @@ -97,9 +98,6 @@ public function add(Resource $resource): void $this->cache[$resource->getName()][$status] = $counter . ''; // Transfer.php check is_string($resource) return; - - $this->cache[$resource->getName()][$key] = $status; - return; } if ($resource->getName() == Resource::TYPE_FILE || $resource->getName() == Resource::TYPE_DEPLOYMENT) { @@ -135,14 +133,17 @@ public function addAll(array $resources): void public function update(Resource $resource): void { $key = $this->resolveResourceCacheKey($resource); - // if rows then updating the status counter only + + /** + * if rows then updating the status counter only + */ if ($resource->getName() == Resource::TYPE_ROW || $resource->getName() == Resource::TYPE_DOCUMENT) { - if (!isset($this->cache[$resource->getName()][$key])) { + $status = $resource->getStatus(); + + if ($status != Resource::STATUS_SUCCESS) { $this->add($resource); - } else { - $status = $resource->getStatus(); - $this->cache[$resource->getName()][$key] = $status; } + return; }