mirror of
https://gitee.com/johng/gf
synced 2026-06-27 17:57:21 +08:00
fix issue in missing passing MaxIdle/MaxActive configuration to underlying redis pool for gredis; add extra output for unit test cases of ghttp.Server
This commit is contained in:
@ -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))
|
||||
|
||||
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user