Skip to content

Change Database class initialisation process#2121

Merged
barijaona merged 3 commits intoViennaRSS:masterfrom
Eitot:feature/database-initialisation
Apr 19, 2026
Merged

Change Database class initialisation process#2121
barijaona merged 3 commits intoViennaRSS:masterfrom
Eitot:feature/database-initialisation

Conversation

@Eitot
Copy link
Copy Markdown
Contributor

@Eitot Eitot commented Mar 29, 2026

This is a followup to #2083.

I believe it is not a good idea to call all the database setup code within the dispatch_once block of the singleton initialiser. I have seen several instances where an exception is thrown or the app will just crash if objects that are meant to be accessed on the main thread are accessed from within that block.

In anticipation of #2063 I investigated which database code is accessed during the loading process of the view hierarchy and found that only the arrayOfFields/fieldByName accessors are read, which don't require the SQLite database to be loaded. I therefore reduced the Database initialiser to just initialise the class and ivars and moved the database setup code into a separate ‑loadDatabaseStore method that is called from ‑applicationDidFinishLaunching:. I made arrayOfFields/​fieldByName lazily loaded and simplified the Field initialisation code by adding a convenience initialiser.

@barijaona barijaona merged commit c9f091e into ViennaRSS:master Apr 19, 2026
2 checks passed
@Eitot Eitot deleted the feature/database-initialisation branch April 19, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants