Skip to content

Commit

Permalink
Fix synchronous data removal from PixelDataStore cache (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx authored and jonathanKingston committed Dec 29, 2021
1 parent 7a69dfc commit 6dfc471
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions DuckDuckGo/Statistics/PixelDataStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ final class LocalPixelDataStore<T: NSManagedObject>: PixelDataStore {
}

func removeValue(forKey key: String, completionHandler: ((Error?) -> Void)?) {
self.cache.removeValue(forKey: key)
let predicate = self.predicate(forKey: key)

func mainQueueCompletion(_ error: Error?) {
Expand All @@ -185,8 +186,6 @@ final class LocalPixelDataStore<T: NSManagedObject>: PixelDataStore {
let changes: [AnyHashable: Any] = [NSDeletedObjectsKey: deletedObjects]
NSManagedObjectContext.mergeChanges(fromRemoteContextSave: changes, into: [context])

self.cache.removeValue(forKey: key)

mainQueueCompletion(nil)
} catch {
mainQueueCompletion(error)
Expand Down

0 comments on commit 6dfc471

Please sign in to comment.