Skip to content

Commit 44ec353

Browse files
committed
Documentation
1 parent 38c0d68 commit 44ec353

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

GRDB/ValueObservation/ValueConcurrentObserver.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ extension ValueConcurrentObserver {
250250
// transaction to complete.
251251
//
252252
// Fetch value & tracked region in a synchronous way.
253+
//
254+
// TODO: we currently perform the initial read from a snapshot, because
255+
// it is a handy way to keep a read transaction open until we grab a
256+
// write access, and compare the database versions. The problem is that
257+
// we do not control the number of created shapshots: we should instead
258+
// use a reader from the pool.
253259
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
254260
let (fetchedValue, initialRegion, initialWALSnapshot) = try initialSnapshot.read {
255261
db -> (Reducer.Fetched, DatabaseRegion, WALSnapshot?) in
@@ -299,6 +305,12 @@ extension ValueConcurrentObserver {
299305
// for observing the database is to be able to fetch the initial value
300306
// without having to wait for an eventual long-running write
301307
// transaction to complete.
308+
//
309+
// TODO: we currently perform the initial read from a snapshot, because
310+
// it is a handy way to keep a read transaction open until we grab a
311+
// write access, and compare the database versions. The problem is that
312+
// we do not control the number of created shapshots: we should instead
313+
// use a reader from the pool.
302314
do {
303315
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
304316
initialSnapshot.asyncRead { dbResult in

0 commit comments

Comments
 (0)