Skip to content

Commit c495449

Browse files
authored
remove timeout middleware and add context timeout (#370)
1 parent dda0bc8 commit c495449

File tree

2 files changed

+29
-68
lines changed

2 files changed

+29
-68
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
description: Context Timeout middleware
3+
---
4+
5+
# Context Timeout
6+
7+
Timeout middleware is used to timeout request context within a predefined period so context aware methods could return
8+
early.
9+
10+
## Usage
11+
12+
```go
13+
e.Use(middleware.ContextTimeout(60 * time.Second))
14+
```
15+
16+
## Custom Configuration
17+
18+
```go
19+
e.Use(middleware.ContextTimeoutWithConfig(middleware.ContextTimeoutConfig{
20+
// Skipper defines a function to skip middleware.
21+
Skipper: nil,
22+
// ErrorHandler is a function when error aries in middleware execution.
23+
ErrorHandler: nil,
24+
// Timeout configures a timeout for the middleware, defaults to 0 for no timeout
25+
Timeout: 60 * time.Second,
26+
}))
27+
```
28+
29+

website/docs/middleware/timeout.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)