Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting a ValueObservation keeps a strong reference on the database connection. #1183

Merged
merged 6 commits into from Mar 17, 2022

Conversation

groue
Copy link
Owner

@groue groue commented Mar 17, 2022

This pull request introduces a change which is between the bugfix and the (small) breaking change.

Starting a ValueObservation now retains the database connection. This means that a database connection won't be deallocated, and won't close, until all observations are stopped (cancelled). As before, starting an observation returns a cancellable which automatically cancels the observation when it is deallocated.

This change removes one difference between ValueObservation and SharedValueObservation.

It was also an opportunity to refactor the inner guts of ValueObservation, which is one of the most complex parts of GRDB. The new implementation is less fancy, more boring, with a smaller api surface, and hopefully easier to maintain.

This prevents a build error when running tests with Xcode 13.3:

error: Cycle inside GRDBiOS; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
@groue groue merged commit e08dfdb into development Mar 17, 2022
@groue groue deleted the dev/strong-observation branch March 17, 2022 18:17
groue added a commit that referenced this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant