From 032dd5307fdc3802352e0333e943ff4ddf5a6100 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Thu, 24 Oct 2024 13:55:57 +0530 Subject: [PATCH] Fix revive error --- .../internal/web/notify_handler.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/common-controller/internal/web/notify_handler.go b/common-controller/internal/web/notify_handler.go index 692f7beb0..6514f09db 100644 --- a/common-controller/internal/web/notify_handler.go +++ b/common-controller/internal/web/notify_handler.go @@ -184,16 +184,15 @@ func storeTokenInRedis(token string, expiry int64) error { err := rdb.Do(context.Background(), "set", key, expiry, "EXAT", expiry).Err() if err != nil { loggers.LoggerAPI.Warnf("Error occured while trying to set key with expiry. Error: %+v. \n Trying to use SET and EXPIREAT command...", err) - err1 := rdb.Do(context.Background(), "set", key, expiry).Err() - if err1 != nil { - loggers.LoggerAPI.Errorf("Error occured while setting the key. Error %+v", err1) + err = rdb.Do(context.Background(), "set", key, expiry).Err() + if err != nil { + loggers.LoggerAPI.Errorf("Error occured while setting the key. Error %+v", err) + return err + } + err = rdb.Do(context.Background(), "expireat", key, expiry).Err() + if err != nil { + loggers.LoggerAPI.Errorf("Error occured while setting the expiry. Error %+v", err) return err - } else { - err1 = rdb.Do(context.Background(), "expireat", key, expiry).Err() - if err1 != nil { - loggers.LoggerAPI.Errorf("Error occured while setting the expiry. Error %+v", err1) - return err - } } } publishValue := fmt.Sprintf("%s%s%d", token, tokenExpiryDivider, expiry)