remove debug messages

This commit is contained in:
yyasha 2024-01-27 21:48:46 +03:00
parent 090efaf84a
commit 53973e329f
1 changed files with 0 additions and 6 deletions

View File

@ -45,7 +45,6 @@ func (c *CacheProvider) GetRecipe(ctx context.Context, r_id uint) (models.Recipe
cache_data := c.rdb.Get(ctx, fmt.Sprintf("recipe:%d", r_id)) cache_data := c.rdb.Get(ctx, fmt.Sprintf("recipe:%d", r_id))
if cache_data.Err() != nil { if cache_data.Err() != nil {
if errors.Is(cache_data.Err(), redis.Nil) { if errors.Is(cache_data.Err(), redis.Nil) {
fmt.Println("--- STORAGE ---")
// if empty - get from storage // if empty - get from storage
recipe, err := c.addRecipe(ctx, r_id) recipe, err := c.addRecipe(ctx, r_id)
if err != nil { if err != nil {
@ -55,7 +54,6 @@ func (c *CacheProvider) GetRecipe(ctx context.Context, r_id uint) (models.Recipe
} }
return models.Recipe{}, fmt.Errorf("%s: %w", op, cache_data.Err()) return models.Recipe{}, fmt.Errorf("%s: %w", op, cache_data.Err())
} }
fmt.Println("--- CACHE ---")
// decode // decode
var recipe models.Recipe var recipe models.Recipe
err := json.Unmarshal([]byte(cache_data.Val()), &recipe) err := json.Unmarshal([]byte(cache_data.Val()), &recipe)
@ -108,7 +106,6 @@ func (c *CacheProvider) GetRecipes(ctx context.Context, offset, limit int) ([]mo
cache_data := c.rdb.Get(ctx, key) cache_data := c.rdb.Get(ctx, key)
if cache_data.Err() != nil { if cache_data.Err() != nil {
if errors.Is(cache_data.Err(), redis.Nil) { if errors.Is(cache_data.Err(), redis.Nil) {
fmt.Println("--- STORAGE ---")
// get from storage // get from storage
recipes, err := c.addRecipesPage(ctx, offset, limit) recipes, err := c.addRecipesPage(ctx, offset, limit)
if err != nil { if err != nil {
@ -118,7 +115,6 @@ func (c *CacheProvider) GetRecipes(ctx context.Context, offset, limit int) ([]mo
} }
return nil, fmt.Errorf("%s: %w", op, cache_data.Err()) return nil, fmt.Errorf("%s: %w", op, cache_data.Err())
} }
fmt.Println("--- CACHE ---")
// decode // decode
var recipes []models.Recipe = make([]models.Recipe, 0, limit) var recipes []models.Recipe = make([]models.Recipe, 0, limit)
err := json.Unmarshal([]byte(cache_data.Val()), &recipes) err := json.Unmarshal([]byte(cache_data.Val()), &recipes)
@ -157,7 +153,6 @@ func (c *CacheProvider) GetRecipesByCategory(ctx context.Context, offset, limit
cache_data := c.rdb.Get(ctx, key) cache_data := c.rdb.Get(ctx, key)
if cache_data.Err() != nil { if cache_data.Err() != nil {
if errors.Is(cache_data.Err(), redis.Nil) { if errors.Is(cache_data.Err(), redis.Nil) {
fmt.Println("--- STORAGE ---")
// get from storage // get from storage
recipes, err := c.addRecipesByCategory(ctx, offset, limit, category) recipes, err := c.addRecipesByCategory(ctx, offset, limit, category)
if err != nil { if err != nil {
@ -167,7 +162,6 @@ func (c *CacheProvider) GetRecipesByCategory(ctx context.Context, offset, limit
} }
return nil, fmt.Errorf("%s: %w", op, cache_data.Err()) return nil, fmt.Errorf("%s: %w", op, cache_data.Err())
} }
fmt.Println("--- CACHE ---")
// decode // decode
var recipes []models.Recipe = make([]models.Recipe, 0, limit) var recipes []models.Recipe = make([]models.Recipe, 0, limit)
err := json.Unmarshal([]byte(cache_data.Val()), &recipes) err := json.Unmarshal([]byte(cache_data.Val()), &recipes)