Skip to content

Commit f43a9f9

Browse files
authored
Merge pull request #64 from fiatjaf/fix/imgproxy-stale-exit
Ignore stale imgproxy process exits when disabling on error
2 parents f3f739b + 3643196 commit f43a9f9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

imgproxy/handler.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ func startImgproxy() {
255255
}
256256

257257
state.mu.Lock()
258-
if state.cmd == cmd {
258+
current := state.cmd == cmd
259+
if current {
259260
state.cmd = nil
260261
state.running = false
261262
if err != nil {
@@ -264,7 +265,9 @@ func startImgproxy() {
264265
}
265266
state.mu.Unlock()
266267

267-
if err != nil && global.Settings.Imgproxy.Enabled {
268+
// only react to the exit of the process we are actually tracking;
269+
// a stale goroutine from a previous instance must not disable a new one
270+
if current && err != nil && global.Settings.Imgproxy.Enabled {
268271
disableImgproxyWithError(err)
269272
}
270273
}(cmd)

0 commit comments

Comments
 (0)