mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-03 19:07:17 +03:00
Escl: Disable 503s until a later version (as it's a breaking change)
This commit is contained in:
parent
de366c958a
commit
f5a5d5b2b4
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user