-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Description
Currently, the client supports retry with WithRetry(true), but retry behavior (attempts, delays, backoff strategy) is not configurable.
Add options to configure retry parameters:
- Maximum retry attempts
- Initial retry delay
- Backoff strategy (exponential, linear, fixed)
- Maximum retry delay
Proposed API
client := spotify.New(auth.Client(ctx, token),
spotify.WithRetry(true),
spotify.WithMaxRetries(3),
spotify.WithInitialDelay(time.Second),
spotify.WithMaxDelay(30*time.Second),
spotify.WithBackoffStrategy(spotify.ExponentialBackoff),
)
// OR
retryCfg := &spotify.RetryConfig{
MaxRetries: 3,
InitialDelay: time.Second,
MaxDelay: 30 * time.Second,
Backoff: spotify.ExponentialBackoff,
}
client := spotify.New(auth.Client(ctx, token),
spotify.WithRetry(true),
spotify.WithRetryConfig(retryCfg),
)Applications with different reliability requirements need control over retry behaviour to balance between request success rate and response latency.
I would be happy to contribute and work on this feature.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels