Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Fix write timeout and allow job queue retries to work properly

Murtaza Nasiraff131d59e40
diff --git a/VERSION b/VERSION
index 2c0a9c7b..b19b5211 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-v0.7.2
+v0.8.0
diff --git a/src/services/transcription/connectors/asr_endpoint.py b/src/services/transcription/connectors/asr_endpoint.py
index d5736bd9..975c760f 100644
--- a/src/services/transcription/connectors/asr_endpoint.py
+++ b/src/services/transcription/connectors/asr_endpoint.py
@@ -115,11 +115,12 @@ class ASREndpointConnector(BaseTranscriptionConnector):
}
# Configure timeout: generous values for large file uploads
+ # Write timeout needs to be high too - large files take time to upload
timeout = httpx.Timeout(
None,
connect=60.0,
read=float(self.timeout),
- write=300.0,
+ write=float(self.timeout),
pool=None
)
diff --git a/src/tasks/processing.py b/src/tasks/processing.py
index 253f0f23..922e5c3d 100644
--- a/src/tasks/processing.py
+++ b/src/tasks/processing.py
@@ -1296,16 +1296,11 @@ def transcribe_with_connector(app_context, recording_id, filepath, original_file
error_type = type(e).__name__
current_app.logger.error(f"Connector transcription FAILED for recording {recording_id}: [{error_type}] {error_msg}", exc_info=True)
- recording = db.session.get(Recording, recording_id)
- if recording:
- recording.status = 'FAILED'
- recording.transcription = format_error_for_storage(error_msg)
-
- end_time = datetime.utcnow()
- recording.processing_time_seconds = (end_time - start_time).total_seconds()
- db.session.commit()
+ # Don't set recording.status = 'FAILED' here - let the job queue handle it
+ # The job queue will decide whether to retry or permanently fail,
+ # and only set FAILED status when all retries are exhausted
- # Re-raise so job queue marks the job as failed
+ # Re-raise so job queue marks the job as failed (and potentially retries)
raise
@@ -1630,17 +1625,12 @@ def transcribe_audio_asr(app_context, recording_id, filepath, original_filename,
if "timed out" in error_msg.lower() or "timeout" in error_msg.lower() or "Timeout" in error_type:
asr_timeout = SystemSetting.get_setting('asr_timeout_seconds', 1800)
current_app.logger.error(f"Timeout details - configured ASR timeout: {asr_timeout}s. Error: {error_msg}")
- user_error_msg = f"ASR processing timed out. Error: {error_msg}"
- else:
- user_error_msg = f"ASR processing failed: {error_msg}"
- recording = db.session.get(Recording, recording_id)
- if recording:
- recording.status = 'FAILED'
- recording.transcription = format_error_for_storage(user_error_msg)
- db.session.commit()
+ # Don't set recording.status = 'FAILED' here - let the job queue handle it
+ # The job queue will decide whether to retry or permanently fail,
+ # and only set FAILED status when all retries are exhausted
- # Re-raise so job queue marks the job as failed
+ # Re-raise so job queue marks the job as failed (and potentially retries)
raise