Example #1
0
 def notify(self, request, context):
     try:
         return self._notify(request)
     except Exception as e:
         return notification_service_pb2.NotifyResponse(
             return_code=notification_service_pb2.ReturnStatus.ERROR,
             return_msg=str(e))
 async def _notify(self, request):
     for notify in request.notifies:
         if notify.key in self.notification_conditions:
             async with self.notification_conditions.get(notify.key):
                 self.notification_conditions.get(notify.key).notify_all()
     async with self.write_condition:
         self.write_condition.notify_all()
     return notification_service_pb2.NotifyResponse(
         return_code=notification_service_pb2.ReturnStatus.SUCCESS,
         return_msg='')