1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-24 05:23:47 +00:00

improve timeout middleware

This commit is contained in:
wernerr 2020-06-21 15:16:41 +02:00
parent 58df347197
commit cf4e2bbcdd

View File

@ -15,6 +15,7 @@ func Timeout(handler fiber.Handler, timeout time.Duration) fiber.Handler {
return handler return handler
} }
// logic is from fasthttp.TimeoutWithCodeHandler https://github.com/valyala/fasthttp/blob/master/server.go#L418
return func(ctx *fiber.Ctx) { return func(ctx *fiber.Ctx) {
select { select {
case concurrencyCh <- struct{}{}: case concurrencyCh <- struct{}{}: