Fix: ttl 为 -1 时续命错误
This commit is contained in:
parent
56c91c28b3
commit
f037aa023a
2
main.go
2
main.go
@ -242,6 +242,8 @@ func renew(shortKey string) {
|
|||||||
|
|
||||||
// 续命
|
// 续命
|
||||||
ttl, _ := redis.Int(redisClient.Do("ttl", shortKey))
|
ttl, _ := redis.Int(redisClient.Do("ttl", shortKey))
|
||||||
|
if ttl != -1 {
|
||||||
_, _ = redisClient.Do("expire", shortKey, ttl+defaultRenewal*secondsPerDay)
|
_, _ = redisClient.Do("expire", shortKey, ttl+defaultRenewal*secondsPerDay)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user