Conversation
6f322b4 to
72d55fa
Compare
|
|
||
| private const val SPACE_SPECIAL_PREVIEW_URI = "%s?scalingup=0&a=1&x=%d&y=%d&c=%s&preview=1" | ||
| private const val FILE_PREVIEW_URI = "%s%s?x=%d&y=%d&c=%s&preview=1&id=%s" | ||
| private const val FILE_PREVIEW_URI = "%s/remote.php/webdav%s?x=%d&y=%d&c=%s&preview=1" |
There was a problem hiding this comment.
I don't think this looks good, OpenCloud is not PHP anymore.
I haven't really looked at the code yet. Where is stuff cached? From the names it seems it was Disk(Lru) before, what is it now? |
|
FYI I'm looking / testing this PR now. @zerox80 |
|
Hi, ill take a look now, was busy sorry |
|
re-test please @guruz |
We completely moved away from the old manual DiskLruCache handling and now rely on Coil's built-in caching mechanism, which is much more efficient and modern. It uses a two-tier caching strategy (both Memory and Disk cache), which is configured centrally in the ThumbnailsRequester.kt Disk Cache: We use Coil's DiskCache.Builder() to store thumbnails in the app's cache directory (thumbnails_coil_cache). It is explicitly limited to 100MB to ensure it doesn't inflate the app storage endlessly. (Location: appContext.cacheDir.resolve("thumbnails_coil_cache")) Memory Cache: We use Coil's MemoryCache.Builder() configured to use up to 25% of the available application memory (maxSizePercent(0.25)). This drastically improves scrolling performance in lists/grids because decoded images are kept directly in memory. Both caches are shared as Singletons (sharedDiskCache and sharedMemoryCache) and passed to the ImageLoader instance, so the caching rules apply globally to all thumbnail requests handled by Coil |
This commit acts as a squash of the thumbnail cache refactoring and avatar fixes. See PR description for full details.
- Update FILE_PREVIEW_URI to use direct native /webdav path. - Use Graph API explicitly for fetching Avatar image, dropping the /index.php/avatar hack & interceptor fallbacks.
a5268f3 to
a5e37bc
Compare
|
(Don't do any changes now on top as I'm working on your branch myself now) I actually think your code is regressing the cache by not going to the cache first if we had a preview already in (disk) cache. I'll check if there is a goo way to fix this.. |
|
Or maybe I take this back. Can ignore this for now then :) |
Or can not ignore this. Because 401 is actually quite likely if access_token has low expiry time. But maybe the actual fix is not related to here, but re-ordering how ConnectionValidator & friends behave or how token expiry is detected. Just notes to myself.. |
|
Hey @guruz, just to share some thoughts on why the cache behaves differently between UnknownHostException and 401 Unauthorized: The difference lies in how OkHttp/Coil handles HTTP responses versus network exceptions when checking the disk cache. When Coil tries to load an image, it might need to validate a stale cache entry. If the device is offline, OkHttp throws an IOException (like UnknownHostException). Coil/OkHttp Cache catches this and correctly falls back to returning the stale disk cache entry. Refresh on 401: Add an OkHttp Authenticator (or Interceptor) to the client used by Coil. When it catches a 401, it can synchronously refresh the token via AccountManager and retry the image request. |
|
Hey, so there was a bug that TUS Upload doesn't get an Etag? Somehow? its fixed now, please test |
|
@zerox80 Thanks for spotting/fixing! I'll try it out.. @TheOneRing CC |
4c430f5 to
68322d8
Compare
TUS PATCH responses from openCloud do not include ETag headers. This caused large file uploads (>10MB) to have null ETags in the local database, breaking thumbnail preview URLs and caching. Changes: - TusUploadHelper: after TUS upload completes, perform a PROPFIND to fetch the file's ETag from the server - PatchTusUploadChunkRemoteOperation: extract ETag from PATCH response header (for future backend support) - UploadFileFromFileSystemWorker: persist ETag to database for both overwrite and non-overwrite uploads - ThumbnailsRequester: use .orEmpty() for null-safe ETag formatting
68322d8 to
4bedd0c
Compare
The Tusd library has a hook called PreFinishResponseCallback, with that REVA could calculate the etag after the last chunk and write it to the response header, but this hook is never used.... Is it atleast planned? Should we open Issue on Opencloud backend repo? |
1e3c41f to
c67246e
Compare
Thumbnail Cache Refactoring and Avatar Fixes
Summary
This pull request refactors the thumbnail caching mechanism to improve performance and stability, and includes critical fixes for user avatar loading. The legacy
ThumbnailsCacheManagerhas been replaced by an optimizedThumbnailsRequesterimplementation, and several thread safety issues have been resolved.Technical Details
Thumbnail Caching
ThumbnailsCacheManagerandDiskLruImageCachein favor of a modern, streamlined approach withinThumbnailsRequester.ThumbnailsRequesterwhen initializing the shared disk and memory caches. Access to these caches is now properly synchronized.Avatar Loading
Other Changes
Impact
These changes significantly reduce the maintenance burden by removing complex legacy caching code and provide a smoother user experience with faster and more reliable thumbnail and avatar loading.
Testing