-
Notifications
You must be signed in to change notification settings - Fork 464
Fail in-flight invocations when worker channel shuts down #11159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 8 commits
99d2e23
78f3a99
d249c4a
eff32c2
ad650ed
16875db
31e0473
4b64ece
5ab7a94
dba3f31
b084a14
8c5cd2f
c904db4
04409f3
8ad875d
dd5017a
22660a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Exceptions | ||
{ | ||
internal class WorkerShutdownException : Exception | ||
satvu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public WorkerShutdownException() { } | ||
|
||
public WorkerShutdownException(string message) : base(message) { } | ||
|
||
satvu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public WorkerShutdownException(string message, string reason) : base(message) | ||
{ | ||
Reason = reason; | ||
} | ||
|
||
public string Reason { get; set; } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Azure.WebJobs.Script.Description; | ||
using Yarp.ReverseProxy.Forwarder; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Http | ||
{ | ||
public class ScriptInvocationRequestTransformer : HttpTransformer | ||
satvu marked this conversation as resolved.
Show resolved
Hide resolved
satvu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public override async ValueTask TransformRequestAsync(HttpContext httpContext, HttpRequestMessage proxyRequest, string destinationPrefix, CancellationToken cancellationToken) | ||
{ | ||
// this preserves previous behavior (which called the default transformer) - base method is also called inside of here | ||
await HttpTransformer.Default.TransformRequestAsync(httpContext, proxyRequest, destinationPrefix, cancellationToken); | ||
|
||
if (httpContext.Items.TryGetValue(ScriptConstants.HttpProxyScriptInvocationContext, out object result) | ||
&& result is ScriptInvocationContext scriptContext) | ||
{ | ||
proxyRequest.Options.TryAdd(ScriptConstants.HttpProxyScriptInvocationContext, scriptContext); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -206,7 +206,7 @@ public Task ShutdownAsync() | |||||
return Task.CompletedTask; | ||||||
} | ||||||
|
||||||
public Task<bool> RestartWorkerWithInvocationIdAsync(string invocationId) | ||||||
public Task<bool> RestartWorkerWithInvocationIdAsync(string invocationId, Exception exception = null) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unused parameter is here because this class implements |
||||||
{ | ||||||
// Since there's only one channel for httpworker | ||||||
DisposeAndRestartWorkerChannel(_httpWorkerChannel.Id); | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.