     private final class Task {
         let key: ImageRequest.LoadKeyForProcessedImage
         let request: ImageRequest
-        var isCancelled = false
         var onCancelled: (() -> Void)?
         weak var imageTask: ImageTask?
         weak var operation: Operation?

            self.key = key
        }

        func cancel() {
            guard !isCancelled else {
                return // Should never get called
            }
            isCancelled = true
            operation?.cancel()
            imageTask?.cancel()
            onCancelled?()

    }

    private func loadImage(with request: ImageRequest, task: Task, finish: @escaping () -> Void) {
        switch destination {
        case .diskCache:
            task.imageTask = pipeline.loadData(with: request, isConfined: true, queue: pipeline.queue, progress: nil) { [weak self] _ in
