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++ {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user