Pacing speech-to-text retries when the external provider is overloaded
MiPi now handles external speech-to-text overload more carefully: only one active STT request runs per resolved configuration while queued siblings wait without creating attempts or occupying provider threads. On 429, server errors, timeouts, or connection failures, MiPi honors Retry-After and applies growing minimum delays; the processing log explains the pause.
When processing audio, MiPi splits recordings into segments and sends them to an external speech-to-text service. If that service reports rate limiting, server errors, timeouts, or connection failures, the previous behavior could send several follow-up requests quickly. This could waste retry budget and make a temporary provider problem look worse. This change lets the STT queue control retry pacing. For each resolved STT configuration, only one active work item may run at a time. Other queued items wait while the current request finishes or the stored pause ends. Waiting does not create new attempts, consume timeout or retry budgets, or hold provider threads. For retryable 429, server-error, timeout, and connection failures, MiPi applies minimum growing delays: the first recovery waits are at least about 30, 60, or 120 seconds depending on the attempt, then growth is capped. A valid Retry-After value from the provider is also respected as a minimum, with a protective cap of one day for absurdly large values. Malformed headers do not create an unbounded pause. The pause is stored in queue metadata alongside the work item's state. It therefore remains visible to later tasks for the same configuration and after an application restart: the system waits using durable queue data instead of blocking a database transaction or provider thread. Independent STT configurations and other processing capabilities are not serialized together. Diagnostics are clearer: logs include numeric delay and resume-time values, and the processing view explains the pause with user-friendly text. Response bodies, arbitrary header contents, and credentials are not logged. A small database index was added to support fast lookup of STT work by configuration; it improves queue selection without changing stored data.