mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
FetchedRecordsController cleanup
This commit is contained in:
1 parent
fba181bfea
commit
f9d82b8ead
1 file changed
+5
-5
@@ -573,7 +573,7 @@ private final class FetchedRecordsObserver<Record: RowConvertible> : Transaction
|
||||
//
|
||||
// We have to make sure that our fetch is processed *before* the next
|
||||
// fetch: let's immediately dispatch the processing task in our
|
||||
// serialized FIFO queue, but have it wait for our fetch to complete
|
||||
// serialized FIFO queue, but have it wait for our fetch to complete,
|
||||
// with a semaphore:
|
||||
let semaphore = dispatch_semaphore_create(0)
|
||||
var fetchedItems: [Item<Record>]! = nil
|
||||
@@ -597,13 +597,13 @@ private final class FetchedRecordsObserver<Record: RowConvertible> : Transaction
|
||||
// Invalidated?
|
||||
guard let controller = self.controller else { return }
|
||||
|
||||
// Compute changes
|
||||
let changes = self.computeChanges(from: self.items, to: fetchedItems)
|
||||
self.items = fetchedItems
|
||||
|
||||
// No changes?
|
||||
let changes = self.computeChanges(from: self.items, to: fetchedItems)
|
||||
guard !changes.isEmpty else { return }
|
||||
|
||||
// Ready for next check
|
||||
self.items = fetchedItems
|
||||
|
||||
dispatch_async(controller.queue) {
|
||||
// Invalidated?
|
||||
guard let controller = self.controller else { return }
|
||||
|
||||
Reference in new issue
Block a user