Skip to content

Task and event flow

Fuzja edited this page Nov 12, 2026 · 1 revision

Task and event flow

Downloads, conversions, and compressions share the frontend queue. Each item records its type, input options, display metadata, status, progress, and output path.

From screen to queue

The Downloader, Converter, and Compressor screens prepare a payload and call enqueue in src/features/queue/queue.ts. The queue service adds a pending item, notifies subscribed React components, and schedules persistence. Some screens start a task immediately; others leave it pending for the user to start later.

When a task starts, the queue service calls the matching native command through Tauri. The native command is registered in src-tauri/src/lib.rs. Download commands use Pulsar Bridge. Conversion and compression commands prepare FFmpeg work.

Progress back to the UI

The backend emits task updates on the download-event event. The bridge integration forwards Pulsar Bridge output, while conversion and compression code emits compatible events for FFmpeg work. Events carry a task ID so the queue can update the matching item.

The frontend event handler in queue.ts passes events to model.ts, which updates progress, ETA, list progress, cancellation, and completion status. The queue UI observes state changes and displays the new status. Task output is also made available to the per-task console.

Concurrency and persistence

The frontend queue controls what is pending and coordinates starts and stops. The backend BridgeState has a process limiter, configured from maximum_concurrent_processes, so active work is capped even when multiple tasks are submitted. Batch operations also use this limiter.

Queue state is persisted through the get_queue_state and save_queue_state commands. The Rust QueueManager stores queue items and priority order in a SQLite database under the app's local data directory. On startup, the app loads the saved queue; tasks that were active when the app stopped are restored as interrupted/pending rather than continuing as if still running.

Where to look when changing task behavior

  • Queue model, scheduling, and event subscription: src/features/queue/queue.ts.
  • Event-to-state transitions: src/features/queue/model.ts and events.ts.
  • Rust command registration: src-tauri/src/lib.rs.
  • Download command and argument preparation: src-tauri/src/features/downloads/.
  • Bridge process and event forwarding: src-tauri/src/infrastructure/bridge/.
  • Conversion command and batch processing: src-tauri/src/features/conversion/.
  • Compression command and FFmpeg arguments: src-tauri/src/features/compression/.
  • Durable queue storage: src-tauri/src/app/queue.rs.

Clone this wiki locally