-
Notifications
You must be signed in to change notification settings - Fork 289
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
Set image expiry #1565
Comments
Investigating this now! |
I created a patch to address this! I set:
All code, testing, and discussion was sent via email, and can be viewed here: https://groups.google.com/a/damus.io/g/patches/c/cGZcTD8zYLE |
Nice! Does it include videos as well? |
Thanks @alltheseas, that's a good point. The patch does not currently include videos. However, I examined the code, and it does not seem like videos are cached at all. 🤔 I already looked at:
In #1472 I remember I did not see any evidence that videos are being cached either, even though someone mentioned that they are. @jb55, would you happen to know if we cache videos and — if we do — in which part of the code we do that? Am I looking at the right places? |
On Fri, Oct 13, 2023 at 05:45:45PM -0700, Daniel D’Aquino wrote:
I created a patch to address this!
I set:
- 1 week for images on notes
- 2 weeks for profile banners
- Never for profile pictures
this is great. good job man.
|
On Fri, Oct 13, 2023 at 06:16:21PM -0700, Daniel D’Aquino wrote:
Thanks @alltheseas, that's a good point. The patch does not currently include videos.
However, I examined the code, and it does not seem like videos are cached at all. 🤔
I already looked at:
- `DamusViewPlayer.swift`
- `DamusVideoPlayerViewModel.swift`
- `AVPlayer`
- `ImageCarousel.swift`
In #1472 I remember I did not see any evidence that videos are being cached either, even though someone mentioned that they are.
@jb55, would you happen to know if we cache videos and — if we do — in which part of the code we do that? Am I looking at the right places?
that's really bad if it were the case. I assumed the video player would
cache things itself, but if not we'll definitely need to fix that. maybe
check the container storage if you find anything?
|
I checked the container of the normal Damus instance running on my phone (4GB+ of data) and could not find any videos. Here is what I tried:
|
This commit adds expiry dates for images added to the Kingfisher cache. The expiry date depends on the context of the image: - Images from notes expire after a week - Images from profile banners expire after two weeks - Profile pictures never expire. Test ---- Device: iPhone 14 Pro (Simulator), iOS: 17.0 Special remarks: Requires minor local mods and debugger connection Steps: 1. Locally change the note image expiry to 5 seconds 2. Set a breakpoint in `removeExpiredValues` function in `DiskStorage.swift` in Kingfisher 3. Disable breakpoints for now 4. Start Damus and go to the profile feed of someone new 5. Scroll down through the images for about a minute 6. Turn on breakpoints 7. Switch to a different app in the simulator (Make Damus go to background mode) 8. Wait for a few seconds. Debugger should hit the breakpoint set. PASS 9. Take note of the fileURLs of the images being deleted 10. Go to that directory where the fileURLs are in via Finder 11. Look at some of the images being deleted. Perhaps save a copy for comparison. 12. Turn off breakpoints, resume execution and go back to Damus 13. Scroll back up. Some images there should match the images being automatically deleted from the cache. PASS Closes: damus-io#1565 Changelog-Added: Add expiry date for images in cache to be auto-deleted after a preset time to save space on storage Signed-off-by: Daniel D’Aquino <[email protected]> Reviewed-by: William Casarin <[email protected]> Signed-off-by: William Casarin <[email protected]>
With the exception of PFPs, set an image auto-expiry date for images, and videos to control damus cache size.
Related: fix clear cache #1472
Explore storage visualization, preferences #1554
The text was updated successfully, but these errors were encountered: