From f2a1493ea089ef9111ecacf84366441e6ed0c97d Mon Sep 17 00:00:00 2001 From: nns Date: Fri, 9 Oct 2026 14:07:54 +0500 Subject: [PATCH] =?UTF-8?q?fix(migration):=20=D0=BB=D1=91=D0=B3=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20expand=20=D0=B4=D0=BB=D1=8F=20=D0=B4=D0=BE=D0=BA?= =?UTF-8?q?=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20(positions,=20?= =?UTF-8?q?=D0=BD=D0=B5=20positions.assortment)=20+=20=D1=82=D0=B0=D0=B9?= =?UTF-8?q?=D0=BC=D0=B0=D1=83=D1=82=20130=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Тяжёлый expand=positions.assortment раскрывал весь товар в каждой позиции → страница гигантская и зависала. assortment.meta.href в позиции есть и без раскрытия. Таймаут HttpClient МойСклада поднят до 130с (страница иногда > 100с). Co-Authored-By: Claude Opus 5.5 --- src/food-market.api/Program.cs | 1 + .../Integrations/MoySklad/MoySkladDocumentImportService.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/food-market.api/Program.cs b/src/food-market.api/Program.cs index 5ad9cf3..bc3cedf 100644 --- a/src/food-market.api/Program.cs +++ b/src/food-market.api/Program.cs @@ -433,6 +433,7 @@ [new Microsoft.OpenApi.Models.OpenApiSecurityScheme var baseUrl = builder.Configuration["MoySklad:BaseUrl"]; if (!string.IsNullOrWhiteSpace(baseUrl)) http.BaseAddress = new Uri(baseUrl); + http.Timeout = TimeSpan.FromSeconds(130); // страница каталога/документов иногда > 100с }) .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { diff --git a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDocumentImportService.cs b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDocumentImportService.cs index 7881950..f01eb4a 100644 --- a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDocumentImportService.cs +++ b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDocumentImportService.cs @@ -72,8 +72,11 @@ private static DateTime MomentToUtc(string? moment) .Select(s => s.MoySkladExternalId!).ToListAsync(ct)).ToHashSet(); var batch = 0; + // expand=positions (НЕ positions.assortment — это раскрывает весь товар и делает + // страницу гигантской/зависающей). assortment.meta.href в позиции есть и так — из него + // берём id товара. await foreach (var d in _client.StreamDocumentsAsync(token, "entity/supply", - "positions.assortment,agent,store", startOffset, null, ct)) + "positions,agent,store", startOffset, null, ct)) { progress.Seen++; if (d.Id is null || done.Contains(d.Id)) { progress.Skipped++; continue; }