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)