Fix: duplicate short key
This commit is contained in:
parent
3f5b8ac05d
commit
1f239cc0c2
4
main.go
4
main.go
@ -153,8 +153,8 @@ func longToShort(longUrl string, ttl int) string {
|
||||
for i := 0; i < 3; i++ {
|
||||
shortKey = generate(6)
|
||||
|
||||
_existsLongUrl, _ := redis.String(redisClient.Do("get", longUrl))
|
||||
if _existsLongUrl != "" {
|
||||
_existsLongUrl, _ := redis.String(redisClient.Do("get", shortKey))
|
||||
if _existsLongUrl == "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user