From a5058e2d513b525c4633cf660bd732f8a97f3c71 Mon Sep 17 00:00:00 2001 From: Rolandas Razma <rolandas@razma.lt> Date: Mon, 22 Feb 2021 10:56:25 +0000 Subject: [PATCH] Update RequestChain.swift --- Sources/Apollo/RequestChain.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Apollo/RequestChain.swift b/Sources/Apollo/RequestChain.swift index 01b7ab5770..b7dad66a1b 100644 --- a/Sources/Apollo/RequestChain.swift +++ b/Sources/Apollo/RequestChain.swift @@ -111,6 +111,11 @@ public class RequestChain: Cancellable { /// Cancels the entire chain of interceptors. public func cancel() { + guard self.isNotCancelled else { + // Do not proceed, this chain has been cancelled. + return + } + self.isCancelled.mutate { $0 = true } // If an interceptor adheres to `Cancellable`, it should have its in-flight work cancelled as well.