Add recovery for missing oneliners
This commit introduces a recovery mechanism to regenerate `oneliner.txt` files for cases where transcription was successful but the oneliner generation failed due to a crash between writing the transcript and the oneliner. The `transcribe::recovery::regenerate_missing_oneliners` function is added and called at startup after `scan_and_enqueue`. This function identifies cases with non-empty transcripts but missing oneliners and triggers their regeneration. The `transcribe::worker::update_oneliner` function is refactored to always regenerate the oneliner from all available transcripts in a case, ensuring that later recordings can correct earlier ones. This replaces the previous `ensure_oneliner` logic which only generated the oneliner if it didn't exist. New helper functions `cases_needing_oneliner` and `all_transcripts_joined` are introduced to support these changes. Comprehensive unit tests are included for the new recovery and file processing logic.
This commit is contained in:
@@ -77,8 +77,13 @@ async fn main() {
|
||||
{
|
||||
let tx = transcribe_tx.clone();
|
||||
let data_path = config.data_path.clone();
|
||||
let client = http_client.clone();
|
||||
let cfg = config.clone();
|
||||
tokio::spawn(async move {
|
||||
transcribe::recovery::scan_and_enqueue(&data_path, &tx).await;
|
||||
// Then catch up oneliners for cases that crashed between
|
||||
// transcript-write and oneliner-write in a previous run.
|
||||
transcribe::recovery::regenerate_missing_oneliners(&data_path, &client, &cfg).await;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user