ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

better erors about what failed in staples (#433)

Co-authored-by: paul miller <paul.miller>

authored by

Paul Miller
paul miller
and committed by
GitHub
75ff6cda 1616adaa

+13 -6
+2 -2
deploy/cronjob-careme-mail.yaml
··· 3 3 metadata: 4 4 name: careme-mail 5 5 labels: 6 - app: careme 6 + app: careme-mail 7 7 spec: 8 8 schedule: "0 * * * *" 9 9 concurrencyPolicy: Forbid ··· 15 15 template: 16 16 metadata: 17 17 labels: 18 - app: careme 18 + app: careme-mail 19 19 job: careme-mail 20 20 spec: 21 21 restartPolicy: Never
+2 -2
deploy/cronjob-wholefoods-scrape.yaml
··· 3 3 metadata: 4 4 name: wholefoods-scrape 5 5 labels: 6 - app: careme 6 + app: wholefoods-scrape 7 7 spec: 8 8 schedule: "0 6 * * 0" 9 9 concurrencyPolicy: Forbid ··· 15 15 template: 16 16 metadata: 17 17 labels: 18 - app: careme 18 + app: wholefoods-scrape 19 19 job: wholefoods-scrape 20 20 spec: 21 21 restartPolicy: Never
+2
internal/albertsons/staples.go
··· 81 81 Rows: stapleRows[category], 82 82 }) 83 83 if err != nil { 84 + // do we want to retry with different reese token? 85 + slog.WarnContext(ctx, "Failed to fetch category", "category", category, "location", locationID, "error", err) 84 86 return nil, err 85 87 } 86 88
+5 -1
internal/kroger/staples.go
··· 57 57 func (p StaplesProvider) FetchStaples(ctx context.Context, locationID string) ([]Ingredient, error) { 58 58 return parallelism.Flatten(defaultStaples(), func(category staplesFilter) ([]Ingredient, error) { 59 59 ingredients, err := searchIngredients(ctx, p.client, locationID, category.Term, category.Brands, category.Frozen, 0) 60 + if err != nil { 61 + slog.WarnContext(ctx, "Failed to fetch category", "category", category.Term, "location", locationID, "error", err) 62 + return nil, err 63 + } 60 64 slog.InfoContext(ctx, "Found ingredients for category", "count", len(ingredients), "category", category.Term, "location", locationID) 61 - return ingredients, err 65 + return ingredients, nil 62 66 }) 63 67 } 64 68
+1 -1
internal/recipes/generator.go
··· 192 192 193 193 ingredients, err := g.staplesProvider.FetchStaples(ctx, p.Location.ID) 194 194 if err != nil { 195 - return nil, fmt.Errorf("failed to get ingredients for staples: %w", err) 195 + return nil, fmt.Errorf("failed to get ingredients for staples for %s: %w", p.Location.ID, err) 196 196 } 197 197 // should this be pushed down into staple proivder? go off product id? 198 198 ingredients = uniqueByDescription(ingredients)
+1
internal/wholefoods/staples.go
··· 59 59 return parallelism.Flatten(defaultStaples(), func(category string) ([]kroger.Ingredient, error) { 60 60 resp, err := p.client.Category(ctx, category, storeID) 61 61 if err != nil { 62 + slog.WarnContext(ctx, "Failed to fetch category", "category", category, "location", locationID, "error", err) 62 63 return nil, err 63 64 } 64 65