hinto-janai/festival

CCD: Preemptive `WalkDir`

hinto-janai opened this issue · 0 comments

What

One of the first steps in CCD is to walk all the directories provided by the user and search for audio/image files.

Most OS's cache directories that have been indexed, although on a fresh boot, a Collection reset will most likely be the first and only process that actually walks through all these directories.

Problem

This leads to a non-trivial amount of time spent walking directories slowly at the beginning of a Collection reset, where otherwise it would be instant.

Solution

Festival (on startup and on folder add) should preemptively walk either:

  • The user's Vec<PathBuf> of custom directories
  • The default ~/Music

so that PATH's are already cached.

This behavior is probably wanted across all Frontend's, so GUI itself probably shouldn't handle this. It should communicate to Kernel the PATHs sometime in the init phase, and Kernel should handle everything.

Maybe a problem

On directories with an insane amount of files, sub-directories, etc, this process may not finish in time and may intervene with an actual Collection reset. When the user wants to reset the Collection, this thread should probably die, if still alive.