fixed-redis-cache
Some checks failed
deploy / deploy (push) Failing after 1m3s

This commit is contained in:
Untone 2024-06-05 21:20:36 +03:00
parent 693f252ae9
commit 76f976937a
2 changed files with 2 additions and 15 deletions

View File

@ -230,21 +230,8 @@ type AuthorProfile struct {
// GetUserAppDataFromRedis retrieves user profile and follows from Redis, combines them into a JSON format, // GetUserAppDataFromRedis retrieves user profile and follows from Redis, combines them into a JSON format,
// and assigns the JSON string to the provided user's ID. // and assigns the JSON string to the provided user's ID.
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) { func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
// Получаем ID автора из Redis
authorIdString, err := c.store.Get(c.ctx, fmt.Sprintf("author:user:%s", userId)).Result()
if err != nil {
return "", err
}
// Преобразуем ID автора из строки в int
var authorId int
err = json.Unmarshal([]byte(authorIdString), &authorId)
if err != nil {
return "", err
}
// Получаем профиль автора из Redis // Получаем профиль автора из Redis
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf("author:id:%d", authorId)).Result() authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf("author:user:%d", userId)).Result()
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -54,7 +54,7 @@ func DeleteUserResolver(ctx context.Context, params model.DeleteUserInput) (*mod
// delete otp for given email // delete otp for given email
otp, err := db.Provider.GetOTPByEmail(ctx, refs.StringValue(user.Email)) otp, err := db.Provider.GetOTPByEmail(ctx, refs.StringValue(user.Email))
if err != nil { if err != nil {
log.Infof("No OTP found for email (%s): %v", user.Email, err) log.Info("No OTP found for email (%s): %v", user.Email, err)
// continue // continue
} else { } else {
err := db.Provider.DeleteOTP(ctx, otp) err := db.Provider.DeleteOTP(ctx, otp)