diff options
| author | historia <historiavg@proton.me> | 2026-08-28 00:59:47 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-28 00:59:47 -0400 |
| commit | 975053f1789771ba5cb9dbe50ba7fe0aa396f0ab (patch) | |
| tree | 9e249f025860a8a0bb89751159b412b3d41b25ba /app/converter/clients/base.py | |
| parent | 967b60342af11ada1cd6a27c935dd336523fb1cd (diff) | |
| download | tts-audiobook-generator-975053f1789771ba5cb9dbe50ba7fe0aa396f0ab.tar.gz | |
fix: silently failing whisper transcription
Diffstat (limited to 'app/converter/clients/base.py')
| -rw-r--r-- | app/converter/clients/base.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/converter/clients/base.py b/app/converter/clients/base.py index d0d57fb..8a0b4e4 100644 --- a/app/converter/clients/base.py +++ b/app/converter/clients/base.py @@ -17,6 +17,19 @@ class ConversionCancelled(Exception): """Raised when the run's cancel event is set (between requests).""" +class NonRetryableTTSError(RuntimeError): + """A deterministic server-side request/config error; retrying cannot help. + + Raised by clients for failures that will reproduce identically on every + attempt (missing server-side reference transcripts, unknown model ids, + missing model contracts, ...). process_chunk_with_retry skips its + remaining attempts and back-off sleeps for these and re-raises, so the + converter aborts with the actionable message instead of burning the + retry budget on a request that can never succeed. Subclasses RuntimeError + so except-handlers written for the plain HTTP-error case keep working. + """ + + # How a run supplies its voice: a built-in CustomVoice speaker, by cloning # a reference audio clip (the faster and audiocpp backends always clone # server-side; only the Qwen client branches on this at request time), or @@ -109,6 +122,8 @@ class BaseTTSClient: Returns the generated chunk file's path, or None when all attempts failed. Raises ConversionCancelled when the run was cancelled. + NonRetryableTTSError is logged once and re-raised without consuming + the remaining attempts (the identical request can never succeed). """ for attempt in range(config.MAX_RETRIES): self._check_cancelled() @@ -119,6 +134,9 @@ class BaseTTSClient: logger.warning("Chunk %d attempt %d failed", chunk_num, attempt + 1) except ConversionCancelled: raise + except NonRetryableTTSError as exc: + logger.error("Chunk %d error (not retried): %s", chunk_num, exc) + raise except Exception as exc: logger.warning("Chunk %d attempt %d error: %s", chunk_num, attempt + 1, exc) |
