fix #14740: keep calls with pending deepscript cleanup from being discarded
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,9 @@ use tauri::{AppHandle, Emitter, Manager, State};
|
||||
use tauri_plugin_autostart::ManagerExt;
|
||||
|
||||
use crate::processing;
|
||||
use crate::state::{AppState, CallBrief, DeviceLevels, Ended, PendingPrompt, RecordingState};
|
||||
use crate::state::{
|
||||
AppState, CallBrief, DeviceLevels, DiscardError, Ended, PendingPrompt, RecordingState,
|
||||
};
|
||||
|
||||
const LEVELS_INTERVAL: Duration = Duration::from_millis(100);
|
||||
|
||||
@@ -118,10 +120,19 @@ pub fn get_call_brief(state: State<'_, AppState>, id: CallId) -> CmdResult<CallB
|
||||
|
||||
/// Deletes a finished call's audio and row. Closes the prompt if no call
|
||||
/// waits for it any more; otherwise the prompt reloads and shows the next.
|
||||
/// While its DeepScript jobs are still on record, nothing is deleted and a
|
||||
/// cleanup starts, so a later try can succeed.
|
||||
#[tauri::command]
|
||||
pub async fn discard_call(app: AppHandle, id: CallId) -> CmdResult<()> {
|
||||
blocking(app, move |app| {
|
||||
app.state::<AppState>().discard_call(id)?;
|
||||
match app.state::<AppState>().discard_call(id) {
|
||||
Ok(_) => {}
|
||||
Err(e @ DiscardError::CleanupPending) => {
|
||||
processing::delete_leftover_jobs(app, vec![id]);
|
||||
return Err(e.to_string());
|
||||
}
|
||||
Err(e @ DiscardError::Other(_)) => return Err(e.to_string()),
|
||||
}
|
||||
prompt_queue_changed(app);
|
||||
Ok(())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user