def start_replicator_server(host, port, db): ''' Run the GRPC Replicator listener server ''' server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) replicator_pb2_grpc.add_ReplicatorServicer_to_server( ReplicatorServer(db), server) server.add_insecure_port('%s:%d' % (host, port)) server.start() return server
def run(host, port): server = grpc.server(futures.ThreadPoolExecutor(max_workers=2)) replicator_pb2_grpc.add_ReplicatorServicer_to_server( MyReplicator(), server) server.add_insecure_port('%s:%d' % (host, port)) server.start() try: while True: print("Server started at...%d" % port) time.sleep(_ONE_DAY_IN_SECONDS) except KeyboardInterrupt: server.stop(0)
def run(host, port): #Run the GRPC server server = grpc.server(futures.ThreadPoolExecutor(max_workers=2)) replicator_pb2_grpc.add_ReplicatorServicer_to_server( ReplicatorService(), server) server.add_insecure_port('%s:%d' % (host, port)) server.start() try: while True: print("Server port: %d" % port) time.sleep(SECONDS_OF_DAY) except KeyboardInterrupt: server.stop(0)