Exemplo n.º 1
0
 def ping(self, request, context):
     self.counter += 1
     if self.counter > 10000:
         print("10000 calls in %3f seconds" % (time.time() - self.last_print_time))
         self.last_print_time = time.time()
         self.counter = 0
     return pingpong_pb2.Pong(count=request.count + 1)
Exemplo n.º 2
0
 def ping(self, request, context):
     '''Described in servicer line 4 '''
     self.counter += 1
     if self.counter > 10000:
         print("10000 calls in %3f seconds" %
               (time.time() - self.lastPrintTime))
         self.lastPrintTime = time.time()
         self.counter = 0
     return pingpong_pb2.Pong(count=request.count + 1)
 def ping(self, request,
          context):  # rpc ping method described in .proto file
     self.counter += 1
     #increase counter
     if (self.counter > 10000):  # if counter value > 10000
         print("10000 calls in %3f seconds" %
               (time.time() - self.lastPrintTime))
         self.lastPrintTime = time.time()
         self.counter = 0
     return pingpong_pb2.Pong(count=request.count +
                              1)  # return count value increased by 1