paolobenve / myphotoshare

MOVED TO GITLAB! --- A Web 2.0 Photo Gallery Done Right via Static JSON, Dynamic Javascript and a bit of php for sharing
15 stars 0 forks source link

Optimization of index files creation #95

Closed pmetras closed 6 years ago

pmetras commented 6 years ago

Another strange behaviour with master branch, probably a case for better optimization.

  1. Clear the gallery cache.
  2. Run the scanner. A lot of .json index files are created.
  3. Run again the scanner, without changing anything. Again .json files are generated while there were no changes between the two runs. Better, some stale files are suppressed when there's an album.ini file!

So image files are generated only when changed. But index files are always generated. We could only recreate them when we detect a change.

And search index files for album metadata are considered stale and deleted. At the first run, one can search for keywords on album's metadata. On the second run, the same search fails.

paolobenve commented 6 years ago

We could only recreate them when we detect a change.

I considered that possibility, and dropped it because:

And search index files for album metadata are considered stale and deleted. At the first run, one can search for keywords on album's metadata. On the second run, the same search fails.

Yes, now album.read_album_ini() is executed only if the json file is invalid. Perhaps it could be executed every time, couldn't it?

paolobenve commented 6 years ago

https://github.com/paolobenve/myphotoshare/commit/a01d0db8907ab27d1ccae9c38e6f38ac199b486f wasn't complete, now is ok

pmetras commented 6 years ago

What should be the strategy to use in the Debian package installer regarding cache content? Currently, I delete all files from cache directory. When the user installs a new version of the Debian package, next run of scanner will start anew with a full generation. Can we optimize that?

Should I keep the content of cache sub-directories (generated pictures) and delete only some .json files?

paolobenve commented 6 years ago

There is no need to delete the cache, the scanner detects the condition when that is needed