async def __aexit__(self, exc_type, exc_value, traceback): if exc_type is None: self.batch = Batch(self._requests) message, future = self._session.connection.send_batch(self.batch) self.results = await self._session._send_concurrent( message, future, len(self.batch)) if self._raise_errors: if any(isinstance(item, Exception) for item in self.results): raise BatchError(self)
async def __aexit__(self, exc_type, exc_value, traceback): if exc_type is None: self.batch = Batch(self._requests) message, event = self._session.connection.send_batch(self.batch) await self._session._send_message(message) await event.wait() self.results = event.result if self._raise_errors: if any(isinstance(item, Exception) for item in event.result): raise BatchError(self)
async def __aexit__(self, exc_type, exc_value, traceback): if exc_type is None: self.batch = Batch(self._requests) message, event = self._session.connection.send_batch(self.batch) await self._session._send_message(message) await event.wait() result = event.result # Can happen with cancel_pending_requests if isinstance(result, CancelledError): raise result self.results = result if self._raise_errors: if any(isinstance(item, Exception) for item in result): raise BatchError(self)