Skip to content

[WIP] Remove database usage from push notification extension #452

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

Draft
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

mpretty-cyro
Copy link
Collaborator

The iOS app has had a long standing crash related to the database, the app crashes with the error code 0xdead10cc (or “Deadlock”) and it happens when the app goes into a “suspended” state whilst it still maintains a lock on the database. We've tried a number of times to resolve this issue without a large structural change but, while we seem to have reduced the frequency, we've been unable to entirely resolve it.

Since we have exhausted all other options the goal now is to move the database file (and any other app data) from the “AppGroup” into the main app directory where the OS will no longer need to put a lock on the file, and as a result the 0xdead10cc should no longer be possible.

The purpose of this PR is to update the Push Notification Extension to function without needing access to the database (the first step needed to relocate the app files).

mpretty-cyro and others added 2 commits May 12, 2025 14:36
• Updated the General cache to include the users seckey (rather than fetching it from the DB every time causing unneeded load)
• Updated a bunch of Crypto usage to no longer need a `db` or `dependencies` instance passed to it
• Added unit tests for General.Cache
• Replaced `Identity.userExists` with `General.Cache.userExists` (no need for database access anymore)
• Moved the SwarmPoller message handling logic into it's own function to make debugging stack traces a little easier
• Cleaned up some hard-to-read logic
DBR - 1 - Cached seckey, cleaned up crypto usage
@mpretty-cyro mpretty-cyro self-assigned this May 13, 2025
@mpretty-cyro mpretty-cyro added enhancement New feature or request Jira This ticket is being tracked in Jira labels May 13, 2025
mpretty-cyro and others added 12 commits May 13, 2025 14:03
• Added the new MessageDeduplication table
• Added a migration to populate the MessageDeduplication table
• Added ExtensionHelper functions to store records in the AppGroup for deduplication purposes
• Updated the logic to use MessageDeduplication table & files for deduplication purposes
• Refactored message parsing to not rely on the database
• Refactored message deduplication to not rely on the database in the PN extension
• Removed the old ControlMessageProcessRecord table
…receiving-process

DBR - 2 - Refactored the message deduplication logic
• Updated the General cache to include the users seckey (rather than fetching it from the DB every time causing unneeded load)
• Updated a bunch of Crypto usage to no longer need a `db` or `dependencies` instance passed to it
• Added unit tests for General.Cache
• Replaced `Identity.userExists` with `General.Cache.userExists` (no need for database access anymore)
• Moved the SwarmPoller message handling logic into it's own function to make debugging stack traces a little easier
• Cleaned up some hard-to-read logic
…message-notification

DBR - 3 - Initial notification extension refactoring, handling visible message PNs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Jira This ticket is being tracked in Jira
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant