ekko: configurable read write and readheader timeouts
This commit is contained in:
11
ekko/ekko.go
11
ekko/ekko.go
@@ -20,7 +20,11 @@ import (
|
||||
)
|
||||
|
||||
func New(name string, options ...func(*Ekko)) (*Ekko, error) {
|
||||
ek := &Ekko{}
|
||||
ek := &Ekko{
|
||||
writeTimeout: 60 * time.Second,
|
||||
readHeaderTimeout: 30 * time.Second,
|
||||
}
|
||||
|
||||
for _, o := range options {
|
||||
o(ek)
|
||||
}
|
||||
@@ -68,9 +72,8 @@ func (ek *Ekko) setup(ctx context.Context) (*echo.Echo, error) {
|
||||
|
||||
e := echo.New()
|
||||
|
||||
// todo: make these an option?
|
||||
e.Server.ReadTimeout = 30 * time.Second
|
||||
e.Server.WriteTimeout = 60 * time.Second
|
||||
e.Server.ReadHeaderTimeout = ek.readHeaderTimeout
|
||||
e.Server.WriteTimeout = ek.writeTimeout
|
||||
|
||||
e.Server.BaseContext = func(_ net.Listener) context.Context {
|
||||
return ctx
|
||||
|
Reference in New Issue
Block a user