Escl: Disable 503s until a later version (as it's a breaking change)

This commit is contained in:
Ben Olden-Cooligan 2024-04-13 16:23:27 -07:00
parent de366c958a
commit f5a5d5b2b4
2 changed files with 7 additions and 2 deletions

View File

@ -293,12 +293,16 @@ internal class EsclApiController : WebApiController
// If we already have a document (i.e. if a connection error occured during the previous NextDocument
// request), we stay at that same document and don't advance
var cts = new CancellationTokenSource();
cts.CancelAfter(5000);
// TODO: Cancel this after a short interval.
// TODO: This is going to break clients that don't have 503 support, so we'll launch that first and keep this change for 7.5.0+
// cts.CancelAfter(1000);
jobInfo.NextDocumentReady = jobInfo.NextDocumentReady || await jobInfo.Job.WaitForNextDocument(cts.Token);
}
catch (TaskCanceledException)
{
_logger.LogDebug("Waiting for document timed out, returning 503");
// Tell the client to retry after 2s
Response.Headers.Add("Retry-After", "2");
Response.StatusCode = 503;
return;
}

View File

@ -196,7 +196,8 @@ public class EsclClient
response.EnsureSuccessStatusCode();
break;
}
var data = await ReadStreamWithPerReadTimeout(await response.Content.ReadAsStreamAsync(), 10_000);
// TODO: Define a NAPS2 protocol extension to shorten this timeout to 10s (once we do the rollout of server-side 503s)
var data = await ReadStreamWithPerReadTimeout(await response.Content.ReadAsStreamAsync(), 60_000);
var doc = new RawDocument
{
Data = data,