数据保护

This commit is contained in:
lifeiyi
2019-03-11 11:01:09 +08:00
parent c22c193e70
commit f30eb8817b
2 changed files with 6 additions and 2 deletions

View File

@@ -111,6 +111,10 @@ func (slf *RedisModule) GoTask(fc Func) error {
// GetConn ...
func (slf *RedisModule) getConn() (redis.Conn, error) {
if slf.redispool == nil {
service.GetLogger().Printf(service.LEVER_FATAL, "Not Init RedisModule")
return nil, fmt.Errorf("Not Init RedisModule")
}
conn := slf.redispool.Get()
if conn == nil {
service.GetLogger().Printf(service.LEVER_ERROR, "Cannot get connection")