Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanjuntao/0719eac354ae238efc6217d36c837f36 to your computer and use it in GitHub Desktop.
Save tanjuntao/0719eac354ae238efc6217d36c837f36 to your computer and use it in GitHub Desktop.
gRPC server launching code
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
users_service.add_UsersServicer_to_server(UsersService(), server)
server.add_insecure_port('127.0.0.1:50051')
server.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
server.stop(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment