fix: Rust MutexGuard ueber await - delta_sync Send-Fehler
MutexGuard wird jetzt vor dem .await gedroppt (take + put back), damit der Future Send-kompatibel ist wie Tauri es erfordert. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ec3d4866e0
commit
10e6211820
|
|
@ -59,9 +59,15 @@ async fn start_sync(state: State<'_, AppState>) -> Result<Vec<String>, String> {
|
|||
|
||||
#[tauri::command]
|
||||
async fn delta_sync(state: State<'_, AppState>) -> Result<Vec<String>, String> {
|
||||
let mut engine_guard = state.sync_engine.lock().unwrap();
|
||||
let engine = engine_guard.as_mut().ok_or("Sync nicht gestartet")?;
|
||||
engine.delta_sync().await
|
||||
// Extract engine from state, dropping the MutexGuard before .await
|
||||
let mut engine = {
|
||||
let mut guard = state.sync_engine.lock().unwrap();
|
||||
guard.take().ok_or("Sync nicht gestartet")?
|
||||
};
|
||||
let result = engine.delta_sync().await;
|
||||
// Put engine back
|
||||
*state.sync_engine.lock().unwrap() = Some(engine);
|
||||
result
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
|
|||
Loading…
Reference in New Issue