fix(migration): лёгкий expand для документов (positions, не positions.assortment) + таймаут 130с

Тяжёлый expand=positions.assortment раскрывал весь товар в каждой позиции → страница
гигантская и зависала. assortment.meta.href в позиции есть и без раскрытия. Таймаут
HttpClient МойСклада поднят до 130с (страница иногда > 100с).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nns 2026-10-09 14:07:54 +05:00
parent 2ed9f04cb2
commit f2a1493ea0
2 changed files with 5 additions and 1 deletions

View file

@ -433,6 +433,7 @@ [new Microsoft.OpenApi.Models.OpenApiSecurityScheme
var baseUrl = builder.Configuration["MoySklad:BaseUrl"]; var baseUrl = builder.Configuration["MoySklad:BaseUrl"];
if (!string.IsNullOrWhiteSpace(baseUrl)) if (!string.IsNullOrWhiteSpace(baseUrl))
http.BaseAddress = new Uri(baseUrl); http.BaseAddress = new Uri(baseUrl);
http.Timeout = TimeSpan.FromSeconds(130); // страница каталога/документов иногда > 100с
}) })
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{ {

View file

@ -72,8 +72,11 @@ private static DateTime MomentToUtc(string? moment)
.Select(s => s.MoySkladExternalId!).ToListAsync(ct)).ToHashSet(); .Select(s => s.MoySkladExternalId!).ToListAsync(ct)).ToHashSet();
var batch = 0; var batch = 0;
// expand=positions (НЕ positions.assortment — это раскрывает весь товар и делает
// страницу гигантской/зависающей). assortment.meta.href в позиции есть и так — из него
// берём id товара.
await foreach (var d in _client.StreamDocumentsAsync<MsDocument>(token, "entity/supply", await foreach (var d in _client.StreamDocumentsAsync<MsDocument>(token, "entity/supply",
"positions.assortment,agent,store", startOffset, null, ct)) "positions,agent,store", startOffset, null, ct))
{ {
progress.Seen++; progress.Seen++;
if (d.Id is null || done.Contains(d.Id)) { progress.Skipped++; continue; } if (d.Id is null || done.Contains(d.Id)) { progress.Skipped++; continue; }