mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-25 19:17:30 +00:00
Allow configuration of SPA startup timeout. Part of #1447
This commit is contained in:
@@ -19,7 +19,6 @@ namespace Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer
|
||||
{
|
||||
private const string LogCategoryName = "Microsoft.AspNetCore.SpaServices";
|
||||
private static TimeSpan RegexMatchTimeout = TimeSpan.FromSeconds(5); // This is a development-time only feature, so a very long timeout is fine
|
||||
private static TimeSpan StartupTimeout = TimeSpan.FromSeconds(50); // Note that the HTTP request itself by default times out after 60s, so you only get useful error information if this is shorter
|
||||
|
||||
public static void Attach(
|
||||
ISpaBuilder spaBuilder,
|
||||
@@ -53,9 +52,10 @@ namespace Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer
|
||||
{
|
||||
// On each request, we create a separate startup task with its own timeout. That way, even if
|
||||
// the first request times out, subsequent requests could still work.
|
||||
return targetUriTask.WithTimeout(StartupTimeout,
|
||||
var timeout = spaBuilder.Options.StartupTimeout;
|
||||
return targetUriTask.WithTimeout(timeout,
|
||||
$"The create-react-app server did not start listening for requests " +
|
||||
$"within the timeout period of {StartupTimeout.Seconds} seconds. " +
|
||||
$"within the timeout period of {timeout.Seconds} seconds. " +
|
||||
$"Check the log output for error information.");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user