Closed groue closed 1 month ago
False alert. The transaction observer is indeed removed after all enqueued pending writes, but notification closures are destroyed right on cancellation, effectively preventing the app from being notified of anything once the observation was cancelled.
When I read the source code of
ValueWriteOnlyObserver.cancel()
andValueConcurrentObserver.cancel()
, it looks like the observation is only cancelled after the currently pending writes (previously enqueued in the writer dispatch queue). Can those pending writes trigger value notifications after cancel() is called? If so, we have to fix this.Related: ideally, cancelling an observation should immediately release the connection. This would help closing database in a clean way, before erasing it from disk.