mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Fix failing test for stopObservingDatabaseChangesUntilNextTransaction() from databaseDidChange()
This commit is contained in:
1 parent
abf48eb86f
commit
3e52e265ce
1 file changed
+7
-1
@@ -288,6 +288,12 @@ class DatabaseObservationBroker {
|
||||
.canonicalTables(database)
|
||||
.impactfulEventKinds(database)
|
||||
|
||||
// Support for stopObservingDatabaseChangesUntilNextTransaction()
|
||||
SchedulingWatchdog.current!.databaseObservationBroker = self
|
||||
defer {
|
||||
SchedulingWatchdog.current!.databaseObservationBroker = nil
|
||||
}
|
||||
|
||||
for observation in transactionObservations where observation.isEnabled {
|
||||
if eventKinds.contains(where: { observation.observes(eventsOfKind: $0) }) {
|
||||
observation.databaseDidChange()
|
||||
@@ -912,7 +918,7 @@ extension TransactionObserver {
|
||||
guard let broker = SchedulingWatchdog.current?.databaseObservationBroker else {
|
||||
fatalError("""
|
||||
stopObservingDatabaseChangesUntilNextTransaction must be called \
|
||||
from the databaseDidChange(with:) method
|
||||
from the `databaseDidChange()` or `databaseDidChange(with:)` methods
|
||||
""")
|
||||
}
|
||||
broker.disableUntilNextTransaction(transactionObserver: self)
|
||||
|
||||
Reference in new issue
Block a user