immich-go icon indicating copy to clipboard operation
immich-go copied to clipboard

Wrong storage template albums

Open joojoooo opened this issue 7 months ago • 2 comments
trafficstars

immich-go creates and adds media to albums after uploading everything. This causes issues when using a storage template like this: {{#if album}}{{album}}{{else}}{{y}}/{{MM}}{{/if}}/{{filename}} which is supposed to place media in a folder with the album name but instead won't do that if the "add to album" request is sent too late.

This is really an immich issue for not having an atomic way to add media to an album on upload. The immich server relies completely on receiving the "add to album" request just in time, if received to late the file is just placed in the wrong folder because storage template job runs before the album is known

I think immich-go should send the requests for albums immediately after every single upload, which is exactly what the immich app or web interface is doing. I can make a PR if you agree :)

joojoooo avatar Apr 11 '25 19:04 joojoooo

It used to be immediately done after the upload, but it was causing a lot of traffic. Now, albums are populated when 100 photos are assigned to an album, or at the end.

The template job can be run immediately after the upload, so there isn't a good moment to add the photo to an album.

However you can re run manually the template job after the upload.

simulot avatar Apr 12 '25 09:04 simulot

but it was causing a lot of traffic

I'm uploading to localhost so that's a non issue, pretty sure most other people do the same. Could be implemented as an option that's disabled by default so people with no traffic problems can enable it easily like --no-album-delay

The template job can be run immediately after the upload, so there isn't a good moment to add the photo to an album.

My bad, the template migration job doesn't ever run automatically. What decides the uploaded file location is not a job and it doesn't happen at a random moment but right after metadata extraction, so there is a good moment to add the photo to the album. I asked on Immich discord:

However you can re run manually the template job after the upload.

I know but I want to avoid that

joojoooo avatar Apr 12 '25 13:04 joojoooo