From f037aa023a56866017f128d736d2f06696c58549 Mon Sep 17 00:00:00 2001 From: CareyWong Date: Tue, 2 Jun 2020 15:19:50 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20ttl=20=E4=B8=BA=20-1=20=E6=97=B6?= =?UTF-8?q?=E7=BB=AD=E5=91=BD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 177e09a..35562bd 100644 --- a/main.go +++ b/main.go @@ -242,6 +242,8 @@ func renew(shortKey string) { // 续命 ttl, _ := redis.Int(redisClient.Do("ttl", shortKey)) - _, _ = redisClient.Do("expire", shortKey, ttl+defaultRenewal*secondsPerDay) + if ttl != -1 { + _, _ = redisClient.Do("expire", shortKey, ttl+defaultRenewal*secondsPerDay) + } } }