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; }