feat: Add recovery scan for pending recordings
This commit introduces a new module `transcribe::recovery` and a function `scan_and_enqueue`. This function is called at startup to find audio files that have not yet been transcribed and re-enqueues them for processing. This ensures that recordings are not lost if the server restarts before transcription is complete. A new integration test `recovery_enqueues_only_pending_recordings` has been added to verify the functionality.
This commit is contained in:
@@ -50,6 +50,15 @@ async fn main() {
|
||||
http_client,
|
||||
));
|
||||
|
||||
// Re-enqueue pending recordings left over from a previous run.
|
||||
{
|
||||
let tx = transcribe_tx.clone();
|
||||
let data_path = config.data_path.clone();
|
||||
tokio::spawn(async move {
|
||||
transcribe::recovery::scan_and_enqueue(&data_path, &tx).await;
|
||||
});
|
||||
}
|
||||
|
||||
let state = AppState {
|
||||
config: config.clone(),
|
||||
transcribe_tx,
|
||||
|
||||
Reference in New Issue
Block a user