Skip to content

Bound session parsing concurrency and report worker panics per file #184

Description

@coderabbitai

Summary

Bound session parsing concurrency in load_session_files and preserve per-file reporting when a worker panics.

Rationale

The current implementation in crates/sivtr-core/src/query/mod.rs creates one scoped thread per session file. Workspaces with many session files can oversubscribe CPU resources, increase peak memory use, or reach host thread limits. A panic during JoinHandle::join() can also stop the full load instead of reporting the affected session as skipped.

Required changes

  • Limit parsing workers to std::thread::available_parallelism(), with a safe fallback of one worker.
  • Distribute session-file tasks across the bounded worker set.
  • Continue processing other session files if one worker panics.
  • Mark every task from a panicking worker as a SkippedSession with the error text parse worker panicked.
  • Do not use unwrap() in production code.

Affected area

  • crates/sivtr-core/src/query/mod.rs
  • load_session_files

Acceptance criteria

  • The number of parsing threads does not exceed the selected worker limit.
  • Normal session-file outcomes retain their existing ordering.
  • A worker panic does not abort the complete workspace load.
  • Each session file not completed because of a worker panic appears in QueryResult::skipped.
  • Relevant tests and strict Clippy checks pass.

Backlinks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions