get-id-debug
All checks were successful
deploy / deploy (push) Successful in 1m29s

This commit is contained in:
Untone 2024-06-06 07:51:45 +03:00
parent 55121656a8
commit 48e1dbf8aa

View File

@ -231,10 +231,13 @@ type AuthorProfile struct {
// and assigns the JSON string to the provided user's ID.
func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
// Получаем ID автора из Redis
authorIdString, err := c.store.Get(c.ctx, fmt.Sprintf("author:user:%s", userId)).Result()
rkey := fmt.Sprintf("author:user:%s", userId)
fmt.Println("get redis cached by key:", rkey)
authorIdString, err := c.store.Get(c.ctx, rkey).Result()
if err != nil {
return "", err
}
fmt.Println("redis found string value:", authorIdString)
// Преобразуем ID автора из строки в int
var authorIdFloat float64
@ -243,6 +246,7 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
return "", err
}
authorId := int(authorIdFloat)
fmt.Println("recognized author id: ", authorId)
// Получаем профиль автора из Redis
authorProfileString, err := c.store.Get(c.ctx, fmt.Sprintf("author:id:%d", authorId)).Result()