ai cooking
0
fork

Configure Feed

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

Stillbroke (#455)

* no reties as real errors

* give some loggin context

---------

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

authored by

Paul Miller
paul miller
and committed by
GitHub
07203d98 677006bf

+10 -2
+9 -2
internal/brightdata/proxy.go
··· 71 71 return withRetries(client), nil 72 72 } 73 73 74 - var _ retryablehttp.LeveledLogger = slog.Default() 74 + // this would be nice but it logs all retries as errors which sets off alerts. 75 + // var _ retryablehttp.LeveledLogger = slog.Default() 76 + type SlogPrintf struct{} 77 + 78 + func (l SlogPrintf) Printf(format string, args ...interface{}) { 79 + // missing context sadly so no operation id 80 + slog.With().Info(fmt.Sprintf(format, args...), "source", "retryablehttp") 81 + } 75 82 76 83 // retrying 5xx errors and network errors, but not context cancellations or 4xx errors. 77 84 func retriable(ctx context.Context, resp *http.Response, err error) (bool, error) { ··· 95 102 func withRetries(baseClient *http.Client) *http.Client { 96 103 retryClient := retryablehttp.NewClient() 97 104 retryClient.HTTPClient = baseClient 98 - retryClient.Logger = slog.Default() 105 + retryClient.Logger = SlogPrintf{} 99 106 100 107 // Keep the library defaults for now: 101 108 // RetryMax=4, RetryWaitMin=1s, RetryWaitMax=30s, Backoff=DefaultBackoff.
+1
internal/recipes/staples.go
··· 89 89 } 90 90 91 91 func defaultStaplesBackends(cfg *config.Config, krogerClient kroger.ClientWithResponsesInterface) ([]backendStaplesProvider, error) { 92 + // should we do this per request so we get new proxies per user? https://github.com/paulgmiller/careme/issues/443 92 93 httpClient, err := brightdata.NewProxyAwareHTTPClient(cfg.BrightDataProxy) 93 94 if err != nil { 94 95 return nil, fmt.Errorf("create bright data proxy-aware client: %w", err)