Skip to content

Commit

Permalink
Revert "Perform changes synchronously (#940)"
Browse files Browse the repository at this point in the history
This reverts commit 6e8d1e3.
  • Loading branch information
zeitschlag committed Feb 19, 2023
1 parent 6e8d1e3 commit 3282459
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension NSManagedObjectContext {

public func performChanges(block: @escaping () -> Void) -> Future<Result<Void, Error>, Never> {
Future { promise in
self.performAndWait {
self.perform {
block()
do {
try self.saveOrRollback()
Expand All @@ -50,13 +50,13 @@ extension NSManagedObjectContext {

extension NSManagedObjectContext {
public func perform<T>(block: @escaping () throws -> T) async throws -> T {
return try performAndWait {
return try await perform(schedule: .enqueued) {
try block()
}
}

public func performChanges<T>(block: @escaping () throws -> T) async throws -> T {
return try performAndWait {
return try await perform(schedule: .enqueued) {
let value = try block()
try self.saveOrRollback()
return value
Expand Down

0 comments on commit 3282459

Please sign in to comment.