mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-13 04:57:29 +00:00
fix: harden scheduler, permissions, and download safety
- Implement scheduler hydration barrier to prevent premature triggers - Track scheduler exact runs using keys to avoid false stops - Use 'System Events' for accurate macOS automation permissions - Prevent system-sleep via proper idle assertions - Ensure download pauses use channel acknowledgements (PauseWithAck) - Require Firelink ownership before replacing files in add/conflict UI - Retain partial download assets when removing entries without deletion - Clear progress state in store when downloads complete or pause to reduce churn - Handle empty/invalid queue selections gracefully
This commit is contained in:
@@ -21,7 +21,7 @@ use std::{
|
||||
};
|
||||
use firelink_lib::download::{DownloadCmd, DownloadCoordinator, DownloadEvent, DownloadPayload};
|
||||
use tempfile::TempDir;
|
||||
use tokio::{net::TcpListener, sync::mpsc, task::JoinHandle};
|
||||
use tokio::{net::TcpListener, sync::{mpsc, oneshot}, task::JoinHandle};
|
||||
use uuid::Uuid;
|
||||
|
||||
const TEST_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
@@ -288,12 +288,19 @@ async fn pause_then_resume_uses_range_and_preserves_integrity() {
|
||||
.await
|
||||
.unwrap();
|
||||
wait_for_progress(&mut events, id, 256 * 1024).await;
|
||||
coordinator.send(DownloadCmd::Pause(id)).await.unwrap();
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
let (pause_tx, pause_rx) = oneshot::channel();
|
||||
coordinator
|
||||
.send(DownloadCmd::PauseWithAck(id, pause_tx))
|
||||
.await
|
||||
.unwrap();
|
||||
pause_rx.await.unwrap();
|
||||
|
||||
let paused_len = tokio::fs::metadata(&output_path).await.unwrap().len();
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
let stable_paused_len = tokio::fs::metadata(&output_path).await.unwrap().len();
|
||||
assert!(paused_len >= 256 * 1024);
|
||||
assert!(paused_len < expected.len() as u64);
|
||||
assert_eq!(stable_paused_len, paused_len);
|
||||
|
||||
coordinator
|
||||
.send(DownloadCmd::Start(Box::new(payload(
|
||||
|
||||
Reference in New Issue
Block a user