fix(cms-upload): scope InfiniteTimeSpan to upload client; add response-wait budget after body completes
This commit is contained in:
@@ -44,17 +44,26 @@ builder.Services.AddHttpClient("DeepDrft.Content", client =>
|
||||
client.BaseAddress = new Uri(contentApiUrl);
|
||||
});
|
||||
|
||||
// Named HttpClient for ApiKey-protected Content API calls (CmsTrackService's vault delete).
|
||||
// API key baked into the default request headers so callers need not add it manually.
|
||||
// Named HttpClient for ApiKey-protected Content API calls (CmsTrackService's non-upload operations:
|
||||
// delete, paged list, metadata read/write, waveform jobs, releases, genres).
|
||||
// Timeout left at the default 100s — these are short request/response pairs and an infinite timeout
|
||||
// would hang an InteractiveServer circuit forever on a dead connection.
|
||||
var contentApiKey = builder.Configuration["Api:ContentApiKey"]
|
||||
?? throw new InvalidOperationException("Api:ContentApiKey is required");
|
||||
builder.Services.AddHttpClient("DeepDrft.Content.Cms", client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(contentApiUrl);
|
||||
client.DefaultRequestHeaders.Add("ApiKey", contentApiKey);
|
||||
// Large mix uploads (several hundred MB) outrun the 100s default whole-request timeout. The send
|
||||
// path enforces an idle/heartbeat deadline instead (CmsTrackService), which can only express
|
||||
// "no bytes for N seconds" if the client itself does not impose a total cap — hence Infinite here.
|
||||
});
|
||||
|
||||
// Dedicated upload client — inherits the API key but removes the whole-request timeout.
|
||||
// Large WAV uploads (several hundred MB) outrun the 100s default. The upload path enforces an
|
||||
// idle/heartbeat deadline instead (body-streaming phase via ProgressStreamContent) plus a separate
|
||||
// response-wait budget (CmsTrackService), so the client itself must not impose a total cap.
|
||||
builder.Services.AddHttpClient("DeepDrft.Content.Cms.Upload", client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(contentApiUrl);
|
||||
client.DefaultRequestHeaders.Add("ApiKey", contentApiKey);
|
||||
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user