diff options
author | John Cai <jcai@gitlab.com> | 2019-11-18 22:38:59 +0300 |
---|---|---|
committer | jramsay <jcai@gitlab.com> | 2019-11-27 03:22:12 +0300 |
commit | 7c4f16371b8f051f1eb3a7e989d26ea7eb962a8e (patch) | |
tree | e3e158da21a79a4ca2b4feeade654505d326785a /internal/praefect/server.go | |
parent | 82d31745e0901dc91c2fe02f44ff8ff659a22c09 (diff) |
Wire in bootstrap package for praefect for zero downtime deploy
Diffstat (limited to 'internal/praefect/server.go')
-rw-r--r-- | internal/praefect/server.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/internal/praefect/server.go b/internal/praefect/server.go index 46ee62cea..ce9e0d0e4 100644 --- a/internal/praefect/server.go +++ b/internal/praefect/server.go @@ -108,17 +108,13 @@ func proxyRequiredOpts(director proxy.StreamDirector) []grpc.ServerOption { } } -// Start will start the praefect gRPC proxy server listening at the provided -// listener. Function will block until the server is stopped or an -// unrecoverable error occurs. -func (srv *Server) Start(lis net.Listener) error { - srv.registerServices() - - return srv.s.Serve(lis) +// Serve starts serving requests from the listener +func (srv *Server) Serve(l net.Listener, secure bool) error { + return srv.s.Serve(l) } -// registerServices will register any services praefect needs to handle rpcs on its own -func (srv *Server) registerServices() { +// RegisterServices will register any services praefect needs to handle rpcs on its own +func (srv *Server) RegisterServices() { // ServerServiceServer is necessary for the ServerInfo RPC gitalypb.RegisterServerServiceServer(srv.s, server.NewServer(srv.conf, srv.clientConnections)) @@ -143,3 +139,13 @@ func (srv *Server) Shutdown(ctx context.Context) error { return nil } } + +// GracefulStop stops the praefect server gracefully +func (srv *Server) GracefulStop() { + srv.s.GracefulStop() +} + +// Stop stops the praefect server +func (srv *Server) Stop() { + srv.s.Stop() +} |