Retry policy
SwiftSonic ships an opt-in retry policy with exponential backoff for transient HTTP failures. By default, no retries are attempted — every error reaches your code immediately.
Enabling retries
Section titled “Enabling retries”TODO: confirm exact API in 0.6.x. Likely a
RetryPolicytype passed viaServerConfiguration. Verify inSources/SwiftSonic/RetryPolicy.swift(or wherever it lives).
// TODO: replace with verified shapelet retry = RetryPolicy( maxAttempts: 3, initialDelay: .milliseconds(200), multiplier: 2.0)
let config = ServerConfiguration( host: "music.example.com", username: "user", password: "pass", retryPolicy: retry)What gets retried
Section titled “What gets retried”Only errors flagged as transient on SwiftSonicError are retried (network timeouts, certain 5xx, transport-level disconnects). Authentication failures, 4xx client errors, and decoding errors are surfaced immediately — retrying would not help.
See Error handling for the full classification.
Server-suggested delay
Section titled “Server-suggested delay”When a server responds with Retry-After, SwiftSonic honours it via SwiftSonicError.suggestedRetryDelay.
TODO: confirm that the retry policy uses
suggestedRetryDelayto override the computed backoff when present.
Disabling retries
Section titled “Disabling retries”Omit the retryPolicy parameter (or pass nil/the documented “no retry” value). The default behaviour is no automatic retries.