Skip to content

Commit 51f3359

Browse files
brettsamCopilot
andcommitted
Rename WorkerChannelBase to WorkerChannel; replace OnDisposing with Dispose(bool) override
Address PR feedback: - Rename WorkerChannelBase -> WorkerChannel (naming nit) - Remove OnDisposing() virtual hook to avoid race with _disposing flag - GrpcWorkerChannel now overrides Dispose(bool) directly, calling StopWorkerProcess() before base cleanup - Set _disposing = true before Dispose(true) in base class Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ef109a1 commit 51f3359

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace Microsoft.Azure.WebJobs.Script.Grpc
2222
{
23-
internal class GrpcWorkerChannel : WorkerChannelBase
23+
internal class GrpcWorkerChannel : WorkerChannel
2424
{
2525
private IWorkerProcess _rpcWorkerProcess;
2626

@@ -86,9 +86,14 @@ public override async Task StartWorkerProcessAsync(CancellationToken cancellatio
8686
}
8787
}
8888

89-
protected override void OnDisposing()
89+
protected override void Dispose(bool disposing)
9090
{
91-
StopWorkerProcess();
91+
if (disposing)
92+
{
93+
StopWorkerProcess();
94+
}
95+
96+
base.Dispose(disposing);
9297
}
9398

9499
protected override void DisposeWorkerResources()

src/WebJobs.Script.Grpc/Channel/WorkerChannelBase.cs renamed to src/WebJobs.Script.Grpc/Channel/WorkerChannel.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
namespace Microsoft.Azure.WebJobs.Script.Grpc
4141
{
42-
internal abstract partial class WorkerChannelBase : IRpcWorkerChannel, IDisposable
42+
internal abstract partial class WorkerChannel : IRpcWorkerChannel, IDisposable
4343
{
4444
private readonly IScriptEventManager _eventManager;
4545
private readonly RpcWorkerConfig _workerConfig;
@@ -91,7 +91,7 @@ internal abstract partial class WorkerChannelBase : IRpcWorkerChannel, IDisposab
9191
private bool _functionMetadataRequestSent = false;
9292
private IOptions<ScriptJobHostOptions> _scriptHostOptions;
9393

94-
internal WorkerChannelBase(
94+
internal WorkerChannel(
9595
string workerId,
9696
IScriptEventManager eventManager,
9797
IScriptHostManager hostManager,
@@ -180,8 +180,6 @@ protected RpcWorkerChannelState State
180180
set => _state = value;
181181
}
182182

183-
protected virtual void OnDisposing() { }
184-
185183
protected virtual void DisposeWorkerResources() { }
186184

187185
public abstract Task StartWorkerProcessAsync(CancellationToken cancellationToken);
@@ -1523,7 +1521,6 @@ protected virtual void Dispose(bool disposing)
15231521

15241522
public void Dispose()
15251523
{
1526-
OnDisposing();
15271524
_disposing = true;
15281525
Dispose(true);
15291526
}

0 commit comments

Comments
 (0)