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:
parent
58df347197
commit
cf4e2bbcdd
@ -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{}{}:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user