Skip to content

Commit

Permalink
fix infinite recursion with idle timer
Browse files Browse the repository at this point in the history
  • Loading branch information
jchorl authored and mostynb committed Jan 4, 2024
1 parent 59a1337 commit ee98006
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ func startHttpServer(c *config.Config, httpServer **http.Server,
}

if c.IdleTimeout > 0 {
ch := cacheHandler // Avoid an infinite loop in the closure below.
cacheHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
idleTimer.ResetTimer()
cacheHandler(w, r)
ch(w, r)
})
}

Expand Down

0 comments on commit ee98006

Please sign in to comment.