Added new stats reporter to check suitable redis pool size

This commit is contained in:
ErickSkrauch
2020-05-01 02:46:12 +03:00
parent 5dbe6af1d0
commit aabf54e318
8 changed files with 94 additions and 0 deletions

View File

@@ -243,6 +243,10 @@ func (db *Redis) Ping() error {
return nil
}
func (db *Redis) Avail() int {
return db.pool.Avail()
}
func buildUsernameKey(username string) string {
return "username:" + strings.ToLower(username)
}

View File

@@ -377,3 +377,8 @@ func (suite *redisTestSuite) TestPing() {
err := suite.Redis.Ping()
suite.Require().Nil(err)
}
func (suite *redisTestSuite) TestAvail() {
avail := suite.Redis.Avail()
suite.Require().True(avail > 0)
}