def hello(self, bs):
            # add a delay
            time.sleep(randint(50, 300) / 100)

            obj = SampleServicePbRequest()
            obj.ParseFromString(bs)
            print("server: Processing request", obj)
            return SampleServicePbResult(result=obj.name).SerializeToString()
Beispiel #2
0
 def hello(self, bs: bytes):
     # add a delay
     # time.sleep(randint(50, 300) / 1000)
     obj = SampleServicePbRequest()
     obj.ParseFromString(bs)
     ret = SampleServicePbResult(result=obj.name).SerializeToString()
     counter.inc()
     return ret
Beispiel #3
0
            def hello(self, bs):
                # add a delay
                time.sleep(self._seed)

                obj = SampleServicePbRequest()
                obj.ParseFromString(bs)
                print("Processing Request", obj)
                return SampleServicePbResult(
                    result=obj.name).SerializeToString()
    def hello(self, bs):
        # add a delay
        time.sleep(randint(50, 300) / 100)

        obj = SampleServicePbRequest()
        obj.ParseFromString(bs)
        print("server: Processing request", obj)
        # reference a pre init member
        ret = obj.name + self._name
        return SampleServicePbResult(result=ret).SerializeToString()