Exemplo n.º 1
0
 def _handle_batch_request(self, msg, rfs):
     def _execute(promise):
         self._log_info(u'Handling batch request: ' + six.text_type(msg))
         response = self._execute_request(msg, rfs)
         self._log_info(
             u'Generated batch response: ' + six.text_type(response))
         promise.set(response)
     tm = self.rpc.concurrent_request_handling
     if tm is None:
         promise = new_promise(ThreadingModel.THREADS)
         _execute(promise)
     else:
         promise = new_promise(tm)
         self._active_threads.append(spawn(tm, _execute, promise))
     return promise
Exemplo n.º 2
0
 def register(self, msg_id):
     promise = new_promise(self.rpc.threading_model)
     if isinstance(msg_id, tuple):
         self._batch_responses[msg_id] = promise
     else:
         self._responses[msg_id] = promise
     return promise