-
Notifications
You must be signed in to change notification settings - Fork 296
Fix Kingfisher cache clearing #3266
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
base: master
Are you sure you want to change the base?
Fix Kingfisher cache clearing #3266
Conversation
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Switched to the local relay model Changelog-Added: Notes now load offline Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
…ed behaviour Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
The widespread usage of the SubscriptionManager caused new crashes to occur when swapping apps. This was caused due to an access to Ndb memory after Ndb has been closed from the app background signal. The issue was fixed with improved task management logic and ensuring all subscription tasks are finished before closing Ndb. Signed-off-by: Daniel D’Aquino <[email protected]>
This commit fixes a crash that caused the app to crash when getting all the follows from a profile. This issue was caused by a use-after-free memory error on inherited transactions after the original transaction is deinitialized. The issue was fixed by introducing a reference count on all transactions and only deallocating the C transaction when the ref count goes to zero. Signed-off-by: Daniel D’Aquino <[email protected]>
Previously, HomeModel could listen to all subscriptions throughout the app, and it would handle reaction and repost counting. Once moved to the local relay model, HomeModel no longer had access to all subscriptions, causing those counts to disappear. The issue was fixed by doing the counting from ThreadModel itself, which better isolates concerns throughout the app. Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
This commit implements nostr network subscriptions that survive between sessions, as well as improved handling of RelayPool opening/closing with respect to the app lifecycle. This prevents stale data after users swap out and back into Damus. Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Added UX hint to make it easier to load new notes Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Improved loading UX in the home timeline Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Increased transaction list limit to 50 transactions Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
This commit improves NostrNetworkManager interfaces to be easier to use, and with more options on how to read data from the Nostr network This reduces the amount of duplicate logic in handling streams, and also prevents possible common mistakes when using the standard subscribe method. This fixes an issue with the mute list manager (which prompted for this interface improvement, as the root cause is similar to other similar issues). Closes: damus-io#3221 Signed-off-by: Daniel D’Aquino <[email protected]>
making more things configurable if you have memory constraints Signed-off-by: William Casarin <[email protected]>
Add relay indexing for existing notes This patch introduces a relay index for new notes and notes that have already been stored, allowing the database to track additional relay sources for a given note. Changes: - Added `NDB_WRITER_NOTE_RELAY` to handle relay indexing separately from new note ingestion. - Implemented `ndb_write_note_relay()` and `ndb_write_note_relay_kind_index()` to store relay URLs. - Modified `ndb_ingester_process_event()` to check for existing notes and append relay info if necessary. - Introduced `ndb_note_has_relay()` to prevent duplicate relay entries. - Updated LMDB schema with `NDB_DB_NOTE_RELAYS` (note_id -> relay) and `NDB_DB_NOTE_RELAY_KIND` (relay + kind + created_at -> note). - Refactored `ndb_process_event()` to use `ndb_ingest_meta` for tracking relay sources. - Ensured proper memory management for relay strings in writer thread. With this change, nostrdb can better track where notes are seen across different relays, improving query capabilities for relay-based data retrieval. Signed-off-by: William Casarin <[email protected]>
This is a simple cursor that walks the NDB_DB_NOTE_RELAYS db Signed-off-by: William Casarin <[email protected]>
…it timeline staleness Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
This improves upon a temporary fix we had for the RelayPool race condition that would cause timeline staleness. The root cause was that during app launch, the HomeModel would subscribe to some filters, and the subscribe function would filter out any relays not yet connected to avoid unnecessary waiting for EOSEs from disconnected relays. However, that filtering would cause the subscribe request to not be queued up or sent back to the relays once connected, causing the relays to never receive those subscription requests and causing timeline staleness. This was fixed by separating the relay list used for the subcription request from the relay list used for waiting for network EOSEs. This allows other mechanisms to ensure the subscription will go through even when the app is initializing and relays are not yet fully connected. Fixes: 61eb833 Signed-off-by: Daniel D’Aquino <[email protected]>
This feature is not production-ready, and is not essential for the current scope of work, so descoping it and hiding it behind a feature flag until it is ready. Changelog-Removed: Removed "Load new content" button Signed-off-by: Daniel D’Aquino <[email protected]>
Closes: damus-io#3252 Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
This attempts to improve the performance of InnerTimelineView by performing event filtering computations on "EventHolder.insert" instead of on each view body re-render, to improve SwiftUI performance. Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
This is to reduce the amount of computation it takes to create the EventActionBar view Signed-off-by: Daniel D’Aquino <[email protected]>
This is a large refactor that aims to improve performance by offloading RelayPool computations into a separate actor outside the main thread. This should reduce congestion on the main thread and thus improve UI performance. Also, the internal subscription callback mechanism was changed to use AsyncStreams to prevent race conditions newly found in that area of the code. Changelog-Fixed: Added performance improvements to timeline scrolling Signed-off-by: Daniel D’Aquino <[email protected]>
Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Optimized network bandwidth usage and improved timeline performance Signed-off-by: Daniel D’Aquino <[email protected]>
|
@alltheseas, unfortunately it does not seem like this fixes the main issue. That part of the cache clearing seems to have been working prior to the PR. I locally downloaded the changes and removed all functional changes — leaving only the new logging code, and reran the test. The results were the same as posted. Device: iPhone simulator
Results: Cache appears to clear; Logs have the same pattern as the PR description I believe the main issue of #2861 is in a different place and more investigation would be needed to find out where it is and reproduce it. @jb55, any other thoughts? |
|
@danieldaquino I compiled Damus from xcode to my local iOS device, and confirmed clear cache works on device. Results were 12.5 GB is reduced to 450-550 MB as displayed in settings -> storage -> damus in iOS menu on device. New commit that works for me on a physical device/ iPhone 13 mini is 5656b59 As to why there are ~~500 MB or so remaining, it has to do with iOS caching |
Closes: damus-io#3275 Signed-off-by: Daniel D’Aquino <[email protected]>
Logical merge errors fixed manually Changelog-None Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-None Signed-off-by: Daniel D’Aquino <[email protected]>
This fixes a hang during sign-up, which was caused by a change in RelayPool handling code that would only send data to handlers with matching subscription IDs. It so happens that some handlers want to receive all notes, and they set the filters to `nil` to achieve that. Furthermore, some sign-up networking code was moved to prevent race conditions. No changelog entry because the behaviour was not changed since the last public release. Changelog-None Closes: damus-io#3254 Signed-off-by: Daniel D’Aquino <[email protected]>
This may negatively impact performance, but improves accuracy and prevents profile loading issues Changelog-None Signed-off-by: Daniel D’Aquino <[email protected]>
Changelog-Changed: Tweaked since optimization filter to capture notes that would otherwise be lost Signed-off-by: Daniel D’Aquino <[email protected]>
5656b59 to
f6426da
Compare
|
f6426da is re-based to local relay model branch @danieldaquino. Tested via xcode to my device. Device successfully clears cache.
|



Summary
fixes kingcache media/image cache clearing bug
Checklist
Closes:orFixes:tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patchesTest report
Tested in Xcode iOS Simulator & MacOS working directory terminal.
Device: 17 Pro iOS Simulator
iOS: iOS 26
Damus: 1.15 (1) 8122a8a
Steps: run terminal log stream command above, disable image blur, go to universe view, scroll for 30 seconds to accumulate sufficient media for kingfisher. go to settings -> appearance -> clear cache, verify in terminal
Results:
Other notes
~1 minute of scrolling without blur in universe view generated over 200 MB of kingfisher cache size!