fix: don't resume Immich jobs on finish if they were never paused - #1420
hugodantas wants to merge 1 commit into
Conversation
finishing() called resumeJobs() unconditionally, regardless of whether
pauseJobs() had actually run. pauseJobs() is itself gated behind
--pause-immich-jobs, but resumeJobs() was not gated the same way.
This has two consequences when --pause-immich-jobs=false:
- resumeJobs() requires the job.create permission on the API key,
which a run that never intended to touch jobs shouldn't need.
- If that call fails (e.g. the key genuinely lacks job.create),
finishing() returns early and skips GenerateReport(), so the run
ends with no asset tracking report at all.
Gate resumeJobs() behind the same uc.client.PauseImmichBackgroundJobs
flag that gates pauseJobs(), so a run that never paused jobs never
tries to resume them.
|
Related: #1425 addresses the same case (no |
More precisely: if #1425 is merged first, this PR's change is fully contained in it and I think this can be closed. The conflict resolution is only needed if this one goes in first. |
`finishing()` calls `resumeJobs()` unconditionally at the end of every upload run, regardless of whether `pauseJobs()` actually ran. `pauseJobs()` is gated behind `--pause-immich-jobs` (default `true`), but the matching `resumeJobs()` call wasn't gated the same way.
This causes two problems when running with `--pause-immich-jobs=false`:
This fix gates `resumeJobs()` behind the same `uc.client.PauseImmichBackgroundJobs` flag that already gates `pauseJobs()`, so a run that never paused jobs never tries to resume them.
Testing
`go build`, `go vet ./...`, and `go test ./...` all pass (note: `app/upload` has no existing test files, so this doesn't add regression coverage for the fix itself — just confirms nothing else broke).
Reproduced against a live v0.32.0 Immich server by running `upload from-google-photos --pause-immich-jobs=false` with an API key scoped only for uploads (no `job.create`): before the fix, the run completed the upload but exited with a `job.create` permission error and no report; after, it completes cleanly with the report generated.