diff --git a/DuckDuckGo/Statistics/PixelDataStore.swift b/DuckDuckGo/Statistics/PixelDataStore.swift index bcb9ec189f..aff4d06d12 100644 --- a/DuckDuckGo/Statistics/PixelDataStore.swift +++ b/DuckDuckGo/Statistics/PixelDataStore.swift @@ -164,6 +164,7 @@ final class LocalPixelDataStore: PixelDataStore { } func removeValue(forKey key: String, completionHandler: ((Error?) -> Void)?) { + self.cache.removeValue(forKey: key) let predicate = self.predicate(forKey: key) func mainQueueCompletion(_ error: Error?) { @@ -185,8 +186,6 @@ final class LocalPixelDataStore: PixelDataStore { let changes: [AnyHashable: Any] = [NSDeletedObjectsKey: deletedObjects] NSManagedObjectContext.mergeChanges(fromRemoteContextSave: changes, into: [context]) - self.cache.removeValue(forKey: key) - mainQueueCompletion(nil) } catch { mainQueueCompletion(error)