mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
Add TestOnBorrow check func of redis pool to verify the getting conn
Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
parent
b48748492e
commit
58eefb9c17
@ -192,6 +192,14 @@ func (bs *Bootstrap) loadAndRunRedisWorkerPool(ctx *env.Context, cfg *config.Con
|
|||||||
redis.DialWriteTimeout(dialWriteTimeout),
|
redis.DialWriteTimeout(dialWriteTimeout),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
TestOnBorrow: func(c redis.Conn, t time.Time) error {
|
||||||
|
if time.Since(t) < time.Minute {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.Do("PING")
|
||||||
|
return err
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
redisWorkerPool := pool.NewGoCraftWorkPool(ctx,
|
redisWorkerPool := pool.NewGoCraftWorkPool(ctx,
|
||||||
|
Loading…
Reference in New Issue
Block a user