Repository navigation
GRPCServer runs a *grpc.Server without depending on grpc - #86
Merged
Merged
Conversation
pior
added this pull request to stack #87
September 27, 2026 16:39
pior
force-pushed
the
v1.1/23-server
branch
from
September 27, 2026 20:32
8317f7d to
909739b
Compare
pior
force-pushed
the
v1.1/23-server
branch
2 times, most recently
from
September 27, 2026 21:37
a8a6911 to
c35ce77
Compare
pior
force-pushed
the
v1.1/23-server
branch
from
September 27, 2026 21:45
c35ce77 to
803d0a1
Compare
pior
marked this pull request as ready for review
October 6, 2026 19:42
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.
Adds the second server wrapper that
ServerOptionwas designed for.GRPCServer(addr, s, opts...)runs a*grpc.Server. It takes an interface with theServe,GracefulStopandStopmethods, so the module doesn't depend on grpc. It behaves and logs likeHTTPServer:listening,draining, thendrained,drain timed outordrain failed.GracefulStop. IfDrainTimeoutexpires first, it callsStopand returnsserver shutdown: context deadline exceeded.HTTPServerandGRPCServershare an unexported server core built from a serve function and a shutdown function.addris required: a*grpc.Serverhas no address.Listener(ln)overrides it.HTTPServerstill readsserver.AddrwhenRunis called, as on main, so anAddrset after construction is still used.Integration module
integration/grpcis a separate Go module that testsGRPCServeragainst a real*grpc.Server: a clean drain, and a drain timeout on a never-ending stream that falls back toStop. grpc stays out of the runnable module, even as a test dependency. CI runs it as a matrix job (lint,go mod verify,go mod tidy -diff,go test -race), andbud integrationruns it locally.gomoddirectivesallows its localreplace.The main test job now also runs
go mod downloadandgo mod verify.