mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 18:19:40 +00:00
When Node is launched with a debug listener, disable connection draining on restart. Fixes #506.
This commit is contained in:
@@ -13,6 +13,13 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
|
||||
/// </summary>
|
||||
public bool NodeInstanceUnavailable { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, indicates that even though the invocation failed because the Node.js instance could not be reached
|
||||
/// or needs to be restarted, that Node.js instance may remain alive for a period in order to complete any
|
||||
/// outstanding requests.
|
||||
/// </summary>
|
||||
public bool AllowConnectionDraining { get; private set;}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="NodeInvocationException"/>.
|
||||
/// </summary>
|
||||
@@ -29,10 +36,20 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
|
||||
/// <param name="message">A description of the exception.</param>
|
||||
/// <param name="details">Additional information, such as a Node.js stack trace, representing the exception.</param>
|
||||
/// <param name="nodeInstanceUnavailable">Specifies a value for the <see cref="NodeInstanceUnavailable"/> flag.</param>
|
||||
public NodeInvocationException(string message, string details, bool nodeInstanceUnavailable)
|
||||
/// <param name="allowConnectionDraining">Specifies a value for the <see cref="AllowConnectionDraining"/> flag.</param>
|
||||
public NodeInvocationException(string message, string details, bool nodeInstanceUnavailable, bool allowConnectionDraining)
|
||||
: this(message, details)
|
||||
{
|
||||
// Reject a meaningless combination of flags
|
||||
if (allowConnectionDraining && !nodeInstanceUnavailable)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
$"The '${ nameof(allowConnectionDraining) }' parameter cannot be true " +
|
||||
$"unless the '${ nameof(nodeInstanceUnavailable) }' parameter is also true.");
|
||||
}
|
||||
|
||||
NodeInstanceUnavailable = nodeInstanceUnavailable;
|
||||
AllowConnectionDraining = allowConnectionDraining;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user