diff --git a/src-tauri/src/watch.rs b/src-tauri/src/watch.rs index 9aad267..fca4046 100644 --- a/src-tauri/src/watch.rs +++ b/src-tauri/src/watch.rs @@ -4,26 +4,30 @@ //! ReadDirectoryChangesW on the WSL 9P mount (`\\wsl$\...`) is unreliable, so //! a 60s tokio interval also runs `refresh_and_emit` to backstop missed events. -use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::time::Duration; use anyhow::Context; -use notify::{RecommendedWatcher, RecursiveMode}; +use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use notify_debouncer_full::{new_debouncer, DebounceEventResult, FileIdMap, Debouncer}; +use tauri::async_runtime::JoinHandle; use tauri::{AppHandle, Emitter, Manager}; use tokio::sync::mpsc; use crate::jsonl::{enumerate_jsonl, parse_jsonl_from, stat as file_stat, UsageEvent}; use crate::paths::resolve_roots; -use crate::state::{AppState, FileCache, SharedState}; +use crate::state::{FileCache, SharedState}; use crate::usage::build_snapshot; /// Lives for the lifetime of the app (held by AppState). Drop unregisters. +/// +/// Note: tasks are spawned via `tauri::async_runtime::spawn`, which returns +/// `tauri::async_runtime::JoinHandle` — distinct from `tokio::task::JoinHandle` +/// even though we use tokio primitives (`time::interval`, `sync::mpsc`) inside. pub struct WatcherHandle { _debouncer: Debouncer, - _poll_task: tokio::task::JoinHandle<()>, - _consumer_task: tokio::task::JoinHandle<()>, + _poll_task: JoinHandle<()>, + _consumer_task: JoinHandle<()>, } pub fn start(app: AppHandle, state: SharedState) -> anyhow::Result {