Commit Graph
23 Commits
Author SHA1 Message Date
Gwendal Roué ac1e5e66be Remove assertion about SQLite snapshot ordering
Fix #1883
2026-09-26 10:20:32 +02:00
Gwendal Roué 21b1322e05 Fix Swiftlint warnings 2026-02-15 15:09:40 +01:00
Gwendal Roué 361a482b1e Enable SQLITE_ENABLE_SNAPSHOT by default and introduce SQLITE_DISABLE_SNAPSHOT 2025-10-12 14:03:09 +02:00
Gwendal Roué b1b83abd8b Simplify the compiler checks for the availability of SQLite snapshots 2025-10-04 14:15:13 +02:00
Gwendal Roué 29f8aa38fb Fix compiler warnings in ValueObservation observers 2024-09-15 12:10:10 +02:00
Gwendal Roué 5f384a4b22 ValueObservation is Sendable 2024-09-08 16:17:51 +02:00
Gwendal Roué 849bba2820 Refactor ValueReducer for Swift concurrency
The fetching facet of a ValueReducer is Sendable.
2024-08-27 08:31:28 +02:00
Gwendal Roué cc5798cf1e WALSnapshotTransaction is Sendable 2024-08-26 08:27:34 +02:00
Gwendal Roué e72a37d7d5 Rename LockedBox to Mutex 2024-08-25 12:40:28 +02:00
Gwendal Roué 8caf31296f [BREAKING] Xcode 16+, Swift 6+ 2024-08-24 15:43:09 +02:00
Gwendal Roué 263a549c21 Test that a cancelled ValueObservation does not notify of changes that were enqueued before cancellation.
This is a test for #1550
2024-06-08 13:47:21 +02:00
Gwendal Roué dff7971cd7 Fix failing test for ValueObservation and Database.notifyChanges(in:) 2023-11-25 15:32:35 +01:00
Gwendal Roué 725d4a3fba When a wal snapshot can't be created, ValueConcurrentObserver fallbacks to plain reads
This commit fixes #1383
2023-06-01 20:00:04 +02:00
Gwendal Roué 65c803a110 Fix #1362 2023-04-29 13:24:46 +02:00
Gwendal Roué d07e8bd3a0 The scenario that leads to the #1362 deadlock 2023-04-18 18:22:47 +02:00
Matt Gallagher c159638498 A test demonstrating deadlock when observer count exceeds size of DatabasePool. 2023-04-18 12:48:06 +10:00
Gwendal Roué d5f38a6a24 Fix Swiftlint warning 2023-04-17 19:17:50 +02:00
Gwendal Roué fcfd6e9028 ValueConcurrentObserver releases its initial WAL transaction earlier 2023-04-15 11:59:19 +02:00
Gwendal Roué 5d9b9edfe1 Fix asyncWALSnapshotTransaction usage.
We must use its result asynchronously.
2023-03-19 12:39:48 +01:00
Gwendal Roué d64274474b ValueObservation: stop creating a new connection on start
Since #1248, ValueObservation on DatabasePool creates a new database connection when it starts. #1256 has revealed that opening a connection can take too much time, which unfortunate consequences: the first value is notified too late, and we block the main thread when the observation is started in the `.immediate` scheduling :-/

In this commit, ValueObservation on DatabasePool just uses one of the available readers, thus avoiding creating a new connection.

When WAL snapshots are available, a long-running read-only transaction is kept opened on this reader, until we can start observing the write transactions, compare database versions, and perform a fetch+notification if and only if the database was modified.

When WAL snapshots are not available (Xcode 14.0 and macOS, or specific SQLCipher or SQLite builds), a double notification of the initial value is always performed, since we can't prove that the database was not changed between the initial fetch and the write access.
2023-03-17 13:52:29 +01:00
Gwendal Roué ac214e6760 SE-0345: if let shorthand for shadowing an existing optional variable 2023-01-30 08:00:47 +01:00
Gwendal Roué 0dd17a9a16 Turn ValueObservationScheduler into a protocol 2022-12-29 12:38:06 +01:00
Gwendal Roué 2dce8d533e Project organization 2022-11-18 13:33:28 +01:00