Skip to content

Commit b1bc331

Browse files
author
Avatarsia
committed
fix(woocommerce): catch SKU-lookup exceptions per chunk in stock sync
ImportSendListLager() wraps the per-chunk batch POSTs in try/catch but the upstream SKU-to-ID lookup was bare: a single failing lookup chunk (timeout, 5xx, rate-limit) aborted the whole sync before the unaffected remaining chunks could even be processed. That gave the batch refactor a larger failure domain than the pre-#266 per-item path it replaced. Lookup exceptions are now logged at error level and the loop continues with the next chunk. Items missing from the SKU map are already handled downstream (logged as not-found, skipped from the update batches). Spotted by review of #266.
1 parent 6a71d4b commit b1bc331

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

www/pages/shopimporter_woocommerce.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,18 @@ public function ImportSendListLager()
621621

622622
foreach ($skuChunks as $skuChunk) {
623623
$skuCsv = implode(',', $skuChunk);
624-
$products = $this->client->get('products', [
625-
'sku' => $skuCsv,
626-
'per_page' => 100,
627-
]);
624+
try {
625+
$products = $this->client->get('products', [
626+
'sku' => $skuCsv,
627+
'per_page' => 100,
628+
]);
629+
} catch (Exception $e) {
630+
$this->logger->error(
631+
'WooCommerce SKU-Lookup-Chunk fehlgeschlagen: ' . $e->getMessage(),
632+
['chunk_size' => count($skuChunk)]
633+
);
634+
continue;
635+
}
628636
if (!is_array($products)) {
629637
continue;
630638
}

0 commit comments

Comments
 (0)