lupinia / awi

Full Lupinia/Awi website, built with Django
https://www.lupinia.net/
2 stars 1 forks source link

Improve sync rate for Sunset batch import folders and image processing #105

Open lupinia opened 1 year ago

lupinia commented 1 year ago

While the background sync system for Sunset is great for periodic updates, it's less great for trying to publish my photos in a reasonable amount of time, because once a folder syncs and finds nothing, it won't check again for several hours. When I built it, I was actually going through a bit of a photography "dry spell", so I mostly used it for bulk imports of my older work that was already published in the old gallery, and that affected my design decisions. But I'm finding it to be rather limiting now. Unfortunately, both the folder-scanning and image-processing systems are fairly slow and resource-intensive (which is why they're background processes that run as a cron job, and none of this happens upon initial import/save), so speeding it up is more complicated than just running it more often.

I had a specific idea when opening this issue, which I will implement connected to it, but it's not the whole solution. So, the problems that need solving:

Current implementation ideas:

  1. Add a "sync now" setting for a folder that overrides the normal re-sync delay. Can be a boolean field for now, but it could also be handled by the resync time option system described below.
  2. Add a per-folder resync time option of some sort. Not quite sure how to implement this, or how granular it needs to be; assuming a default of 24 hours, I would also want options for several times a day (like once every 2-4 hours), and once per week, so I could probably get by with a "sync speed" setting with options of "slow", "standard", and "fast" (or something to that effect). The most efficient option would probably be to add a "next sync" datetime field, which is set during sync based on the sync speed setting.
  3. Switch the folder sync code to only check one folder per maintenance command execution.
  4. Adjust the cron job schedule to run every 5 minutes instead of every 15 minutes.