Fix: duplicate short key

This commit is contained in:
CareyWong 2020-03-29 01:48:44 +08:00
parent 3f5b8ac05d
commit 1f239cc0c2

View File

@ -153,8 +153,8 @@ func longToShort(longUrl string, ttl int) string {
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
shortKey = generate(6) shortKey = generate(6)
_existsLongUrl, _ := redis.String(redisClient.Do("get", longUrl)) _existsLongUrl, _ := redis.String(redisClient.Do("get", shortKey))
if _existsLongUrl != "" { if _existsLongUrl == "" {
break break
} }
} }