Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize creation of Events and Authors #632

Merged
merged 10 commits into from
Nov 17, 2023
Prev Previous commit
Next Next commit
Fixed slow tests when using in memory store.
mplorentz committed Nov 15, 2023
commit d2b0787867e018c1146739c6597b5ace4a34c738
2 changes: 1 addition & 1 deletion Nos/Models/Author+CoreDataClass.swift
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ public class Author: NosManagedObject {
let fetchRequest = NSFetchRequest<Author>(entityName: "Author")
fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \Author.lastUpdatedContactList, ascending: false)]
fetchRequest.predicate = NSPredicate(
format: "hexadecimalPublicKey IN %@.follows.destination.hexadecimalPublicKey",
format: "ANY followers.source = %@",
author
)
return fetchRequest
1 change: 1 addition & 0 deletions Nos/Models/Persistence.swift
Original file line number Diff line number Diff line change
@@ -85,6 +85,7 @@ class PersistenceController {
})
}
setUp()
viewContext.reset()
creationContext = newBackgroundContext()
backgroundViewContext = newBackgroundContext()
parseContext = newBackgroundContext()
1 change: 0 additions & 1 deletion Nos/Service/SocialGraphCache.swift
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ import Logger
}
} catch {
Log.error(error.localizedDescription)
return
}

userWatcher?.delegate = self
5 changes: 2 additions & 3 deletions NosTests/SocialGraphTests.swift
Original file line number Diff line number Diff line change
@@ -19,10 +19,9 @@ final class SocialGraphTests: XCTestCase {
// For some reason that I can't figure out using an in-memory persistent store causes these tests to take
// several minutes instead of seconds, so we are using an on-disk store for these tests instead.
withDependencies { dependencies in
let persistenceController = PersistenceController(containerName: "NosTests")
persistenceController.resetForTesting()
let persistenceController = PersistenceController(containerName: "NosTests", inMemory: true)
testContext = persistenceController.viewContext
dependencies.persistenceController = persistenceController
self.testContext = persistenceController.viewContext
} operation: {
super.invokeTest()
}