-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Implement .nomedia/.noimage filter #944
Conversation
ae40bc4
to
957674b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm afraid such request will have an insane load on instances with high number of files.
Do you have some rough benchmarks on how long this search takes? :)
Happy new year Marcel!! 🎉 🤗
Mh, I see, that would be bad. But why would this specific DAV search query take longer than e.g. the "Your Photos" search query? I'm happy to do a benchmark, though :) |
BenchmarkI loaded ~10.000 files into my dev instance. Not sure if that's enough, big instances are probably considerably larger, but it's something.
The DAV search for .nomedia/.noimage files with infinite depth for the current user takes ~247ms while the normal Timeline DAV search takes ~200ms. |
That is quite high. It means we'd have to wait for quite some time before we get the final list of files 🤔 |
As I understand it the two queries should be executed in parallel, because Vue doesn't wait for the created hook to finish, so the load time should be increased by ~50ms in my setup. I'm happy to close this PR in favor of #939, though, as long as we can land .nomedia filtering. :) |
/compile amend /js |
957674b
to
68adffe
Compare
Maybe it would be best to have a private API for that. Just returning the ignored paths? |
@skjnldsv That would go into the direction of #939 if I understand you correctly. Although, #939 maintains a database table for ignored paths. A compromise between the two PRs would be to have an initial state that does the same query as the SEARCH request in this PR? |
Either initial state or dedicated request, both are fine. The database extra seems a bit overpowered, maybe it's worth doing a bit of in-depth analysis on how long and expensive a php search request would be. Then we can maybe drop the table idea. 🤷 |
I'd defer to @icewind1991 on this, but from what I understand, there's the file cache table in the database which lists all files in the instance and fetching all .nomedia files from that should be fairly fast, be it using a WebDAV SEARCH request or a custom SQL query:
On-demand is hard to do, IMHO, because we don't know whether there are any .nomedia files until we've fetched the list, right? |
you can make that part of the async/await process. EDIT: but it'sj just brain dumps, feel free to go for an initialstate approach too :) |
That's what I'm doing in this PR already I believe. The request I add in these commits never blocks anything. So, while the request does cause load on the server, it theoretically shouldn't affect the user experience.
My crucial point is that the main bottleneck is (probably) SQL (for querying the file cache) in this, if we use WebDAV, or initialState or a private API, we still have the same SQL query in the end (minus the XML parsing, granted). A private API for this IMHO has no benefits over using the official WebDAV SEARCH endpoint. Using initial state has the drawback of adding the runtime of the query to the initial page load, which of course blocks the app loading, while using a request on demand on vue.js init does not. The performance impact of the query remains. One way to make the SEARCH request faster is an index on the filecache table à la Alternatively we go down the route of constructing our own "index" of .nomedia files á la #939 (which I also find a bit overengineering from a software engineering perspective, but what can you do). |
A compromise would be to cache the result of searching for .nomedia files in PHP, based on the Etag of the user's root folder. Then we'd only have the performance hit of the SQL query once, in case the file tree of the current user has changed (instead of on every photos app load), but we wouldn't have the overhead of adding extra db tables and a file system hook. @skjnldsv What do you think? |
/compile amend / |
1878e80
to
07a81e3
Compare
@icewind1991 Thanks for getting back to me on this :) Do you think my current approach (cached file cache search based on user folder Etag) makes sense (especially performance wise)? How would you recommend to handle this? |
Looks great now @marcelklehr :) |
We could add a note to the README, maybe, but I wouldn't add it to the app UI |
I fear you need to rebase manually:
and then
|
@szaimen party time 🎉 😆 |
07a81e3
to
61aea78
Compare
Do you want me to fix the psalm errors? |
ping @skjnldsv |
/compile amend / |
e691d72
to
ccc8229
Compare
ccc8229
to
1aaaa28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
for Timeline and Tags fixes #234 Signed-off-by: Marcel Klehr <[email protected]>
acda1ff
to
825e01d
Compare
How I can see in which release is this coming? I was waiting for something like this since 2 years *_* EDIT: I guess v24, I have just seen the milestone |
Are these (.noimage/.nomedia) supposed to be files resident in the filesystem, or folder tags? |
Simply create an empty file in the file system |
don't know why, but started working after running some extra occ files:scan (runs by cron together with preview:generate may times a day). perfect 👍 |
for Timeline and Tags. Happy new year ✨
fixes #234
The main difference to #939 is that that one maintains a DB table with excluded paths which is the loaded on the client using initialState, while this PR
uses a DAV SEARCH for .nomedia/.noimage files on initial page loaduses a cached file search loaded on the client using initialState.