async def run_operation(self, operation: Operation[Context, RootValue]) -> None:
        """The operation task's top level method. Cleans-up and de-registers the operation once it is done."""
        result_source: ExecutionResult | SubscriptionResult

        try:
            # Get an AsyncGenerator yielding the results
            if operation.operation_type == OperationType.SUBSCRIPTION:
                result_source = await self.schema.subscribe(
                    query=operation.query,
                    variable_values=operation.variables,
                    operation_name=operation.operation_name,
                    context_value=self.context,
                    root_value=self.root_value,
                )
            else:
                result_source = await self.schema.execute(
                    query=operation.query,
                    variable_values=operation.variables,
                    context_value=self.context,
                    root_value=self.root_value,
                    operation_name=operation.operation_name,
                )

            # TODO: maybe change PreExecutionError to an exception that can be caught

            if isinstance(result_source, ExecutionResult):
                if isinstance(result_source, PreExecutionError):
                    assert result_source.errors
                    await operation.send_initial_errors(result_source.errors)
                else:
                    await operation.send_next(result_source)
            else:
                is_first_result = True

                async for result in result_source:
                    if is_first_result and isinstance(result, PreExecutionError):
                        assert result.errors
                        await operation.send_initial_errors(result.errors)
                        break

                    await operation.send_next(result)
                    is_first_result = False

            await operation.send_operation_message(
                CompleteMessage(id=operation.id, type="complete")
            )

        except Exception as error:  # pragma: no cover
            await self.handle_task_exception(error)

            with suppress(Exception):
                await operation.send_operation_message(
                    {"id": operation.id, "type": "complete"}
                )

            self.operations.pop(operation.id, None)

            raise
        finally:
            # add this task to a list to be reaped later
            task = asyncio.current_task()
            assert task is not None
            self.completed_tasks.append(task)
The operation task's top level method. Cleans-up and de-registers the operation once it is done.
strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py