[Compute Separation] M1: Extract WorkerChannelBase from GrpcWorkerChannel#11652
Merged
[Compute Separation] M1: Extract WorkerChannelBase from GrpcWorkerChannel#11652
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the gRPC worker channel implementation by extracting the bulk of GrpcWorkerChannel logic into a new WorkerChannelBase, leaving GrpcWorkerChannel as a small sealed implementation that wires in the concrete worker process and file-watcher subscription.
Changes:
- Introduce
WorkerChannelBaseto host common channel/message-processing, invocation, and capability logic. - Update
GrpcWorkerChannelto inherit fromWorkerChannelBaseand override only process-specific behaviors. - Remove the
GrpcWorkerChannel.Log.cspartial by relocating the logger helpers into the new base class.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/WebJobs.Script.Grpc/Channel/WorkerChannelBase.cs | New shared base class containing the worker channel core logic and logger helpers. |
| src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs | Simplified concrete channel implementation deriving from WorkerChannelBase. |
| src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.Log.cs | Deleted; logger helpers moved into WorkerChannelBase. |
fabiocav
reviewed
Mar 13, 2026
fabiocav
approved these changes
Mar 13, 2026
kshyju
approved these changes
Mar 18, 2026
TestGrpcWorkerChannel in ApplicationInsightsTestFixture inherits from GrpcWorkerChannel to override UpdateCapabilities for testing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ispose(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>
51f3359 to
54981a1
Compare
fabiocav
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pure refactor — extract all gRPC protocol logic from
GrpcWorkerChannel(1,860 lines) into a new abstract base classWorkerChannelBase, leaving only process-management code (~124 lines) inGrpcWorkerChannel.Virtual hooks added for M2:
WorkerProcessId,OnDisposing(),DisposeWorkerResources(),BeginInboundProcessing().Resolves #11641
Changes
WorkerChannelBase.cs(new, ~1,833 lines) — abstract base class with all gRPC protocol logic, message processing, invocation handling, capabilities, shared memory, logging, nested classesGrpcWorkerChannel.cs(1,860 → ~124 lines) — sealed class inheritingWorkerChannelBase, contains only:_rpcWorkerProcessfield, slim constructor,StartWorkerProcessAsync,StopWorkerProcess, dispose hooks,FileEventsubscriptionGrpcWorkerChannel.Log.cs— Logger class moved to baseTesting
GrpcWorkerChannelTestspass without any test modifications