Database Wrapper Cleanup#675
Merged
mpretty-cyro merged 73 commits intoMar 27, 2026
Merged
Conversation
• Updated the home screen to fetch the pinned conversation count as part of it's state rather than when generating swipe actions • Updated calls to use non-blocking database queries • Updated the emoji picker to use a non-blocking database query to fetch recent reactions • Updated the MediaGalleryViewModel to use non-blocking database queries and caching to fetch album info • Updated the notification presenter to use non-blocking database queries to fetch thread info • Updated the dev settings screen to fetch the PN state as part of it's query instead of in a blocking way when being initialized • Updated the NewClosedGroupVC to use a non-blocking database query to get contacts • Removed synchronous read/write calls from database wrapper • Removed publisher read/write calls from database wrapper
• Updated Storage to be an actor and drastically simplified the code (only supports async/await now) • Updated database migration code to try to be self-recoverable after a suspension • Removed overly complex `applicationWillEnterForeground` code
• Fixed a bug in the network resilience tests • Fixed a bug where the new group screen wouldn't show the contacts list
mpretty-cyro
marked this pull request as ready for review
March 6, 2026 01:10
• Attempt to fix a layout discrepancy from the regression tests • Fixed a bug where old messages wouldn't be fetched after joining a community • Fixed a bug where the loading indicator when deleting a message wasn't getting dismissed • Fixed a bug where batch requests containing message sending wouldn't send sync messages
• Fixed a possible race condition which could result in conversations with profiles that are missing their display pictures updating to render their display pics once they are downloaded • Fixed a race conditions where a call message could be sent before setting the local description resulting in call failures • Fixed a race condition where receiving call messages out of order could result in data getting dropped and call failures • Fixed a couple of race conditions where continuations could be resolved multiple times which could result in a crash • Fixed an issue where we would process call messages for already ended calls which could prevent subsequent calls from working • Fixed an issue where the call description could get updated after the call had ended (which looked strange) • Fixed an issue where the code would blindly retry answering a call even if it was already in a closed state (this could block subsequent calls from being answered)
• Fixed an issue where removing a value from UserDefaults wouldn't emit an event • Fixed an issue where checking whether a feature has been set could return a false negative
• Added an initial event buffer to the ObservationManager to catch events which are sent during initial setup/query which could fall through the cracks • Simplified the ObservationManager interface • Refactored the ThreadDisappearingMessagesSettingsViewModel to use the new ObservationBuilder and observe role changes to resolve a race condition of trying to set disappearing messages before the users role has been received • Fixed a couple race conditions in the ObservationManager • Fixed a race condition when removing dependencies from job in the JobRunner
# Conflicts: # Session.xcodeproj/project.pbxproj # SessionUIKit/Components/SwiftUI/DonationCTAModal.swift
# Conflicts: # Session/Utilities/DonationsManager.swift # SessionUIKit/Components/SwiftUI/DonationCTAModal.swift # SessionUtilitiesKit/Dependency Injection/Dependencies.swift
• Updated the code to handle a bad url as a bad url error instead of an unknown error • Fixed an issue where all rooms for a SOGS would be polled instead of just the ones the user had joined • Fixed an issue where we would needlessly try to start community pollers once for every room • Fixed an issue where a group in an invalid state could prevent push notification subscriptions • Fixed an issue where the group poller would poll every 3 seconds indefinitely for groups with no messages
• Added a log to debug an attachment download issue • Added a value to track the number of concurrent • Fixed an issue where we could try to process reactions for a community message after failing to insert the message • Fixed an issue where a dedupe record could incorrectly be inserted for a community message which failed to be handled • Fixed an issue where the network would be started in the notification service extension needlessly (now defer until actually needed)
• Removed a test log • Fixed regression which broke group polling
• Added the unique constraint back to the display picture download job (fixing a duplicate job error causing queue starvation issues) • Fixed a race condition where some blocking jobs that require the user to exist could run before we can detect whether the user exists • Fixed a bug where `FetchablePair` wasn't handling `DatabaseValueConvertible` correctly • Fixed a couple of bugs in the JobRunner where jobDependencies may not be handled correctly • Fixed a bug where display pictures could be prioritised over attachments where there is no `activeThreadId` (in that case they will be prioritised by timestamp)
• Added an optimisation to avoid updating the priority context if it's already set to the current value (could happen when returning to the conversation screen from it's settings screen) • Further tweaked the sorting so downloads for the current conversation are prioritised over display pictures for the conversation list • Fixed the unique constraint on the new `uniqueHashValue` column on the Job table
• Added additional logs to try to made debugging some database failure cases easier • Tweaked some logs to suppress false warnings • Tweaked some logic to source some additional pro data via the SessionProManager rather than using inline logic • (Probably) Fixed a bug where the pro badge could incorrectly show in the "Note to Self" title
• Removed the GRDB usage from SessionNetworkingKit • Replaced the Session-GRDB-swift fork SPM dependency with the (more) official SQLCipher/GRDB.swift SPM dependency • Updated to the latest GRDB (7.10.0) • Fixed an issue so task cancellation is correctly propagated to database queries
• Fixed a bug where trying to schedule an auto-download the users display picture was happening in a read query instead of a write • Fixed a bug where the network instance could be incorrectly created when receiving a PN
• Fixed an issue where notification messages would only be processed on launch and not on return from background • Fixed an edge case where a notification may not be shown when received while backgrounding the app • Fixed an issue where the `DisappearingMessagesJob` could needlessly schedule additional jobs
• Fixed an issue where the home screen wouldn't update message snippets when returning from the background
• Updated to the latest libSession • Fixed an incorrect donations URL • Fixed failing unit tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
applicationWillEnterForegroundcodeNote: This is based on #500