diff --git a/database/gredis/gredis.go b/database/gredis/gredis.go index fb4ac3803..eb2418bb2 100644 --- a/database/gredis/gredis.go +++ b/database/gredis/gredis.go @@ -75,6 +75,8 @@ func New(config Config) *Redis { pool: pools.GetOrSetFuncLock(fmt.Sprintf("%v", config), func() interface{} { return &redis.Pool{ IdleTimeout: config.IdleTimeout, + MaxActive: config.MaxActive, + MaxIdle: config.MaxIdle, MaxConnLifetime: config.MaxConnLifetime, Dial: func() (redis.Conn, error) { c, err := redis.Dial("tcp", fmt.Sprintf("%s:%d", config.Host, config.Port)) diff --git a/net/ghttp/ghttp_unit_middleware_test.go b/net/ghttp/ghttp_unit_middleware_test.go index c7c10095f..2c568c278 100644 --- a/net/ghttp/ghttp_unit_middleware_test.go +++ b/net/ghttp/ghttp_unit_middleware_test.go @@ -204,10 +204,12 @@ func Test_Middleware_Hook_With_Static(t *testing.T) { s.Group("/", func(g *ghttp.RouterGroup) { g.Hook("/*", ghttp.HOOK_BEFORE_SERVE, func(r *ghttp.Request) { a.Append(1) + fmt.Println("HOOK_BEFORE_SERVE") r.Response.Write("a") }) g.Hook("/*", ghttp.HOOK_AFTER_SERVE, func(r *ghttp.Request) { a.Append(1) + fmt.Println("HOOK_AFTER_SERVE") r.Response.Write("b") }) g.Middleware(func(r *ghttp.Request) {