Skip to content

perf(parser): improve performance and progress reporting for NZBs with 430 Not Found - #394

Merged
javi11 merged 3 commits into
mainfrom
perf/parser-430-optimizations
Mar 6, 2026
Merged

perf(parser): improve performance and progress reporting for NZBs with 430 Not Found#394
javi11 merged 3 commits into
mainfrom
perf/parser-430-optimizations

Conversation

@javi11

@javi11 javi11 commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Higher I/O parallelism: goroutine pool sizes for fetchAllFirstSegments and ParseFile changed from runtime.NumCPU() to min(n, 20) — these operations are network-bound, not CPU-bound
  • Skip redundant NNTP calls: segment IDs that returned 430 are cached in a notFoundIDs set and short-circuited in normalizeSegmentSizesWithYenc, saving 1–3 NNTP round-trips per missing file
  • Parallel 16KB completion: the sequential loop that fetches extra segments to reach 16KB is replaced with a parallel errgroup fetch + in-order assembly
  • Distinguish 430 vs transient: FirstSegmentData.IsArticleNotFound is now populated so future retry logic can treat permanent and transient failures differently
  • Progress never stalls: UpdateDownloadProgress is called on every error path in fetchYencHeaders and known-404 shortcuts; ParseFile now accepts a progress.ProgressTracker and ticks it atomically per file so the broadcaster UI bar advances incrementally (0→10%) during parsing instead of jumping only when the entire parse finishes

Test plan

  • go test ./internal/importer/parser/... passes
  • go test ./internal/importer/... passes
  • make (full build) passes
  • Manual: import an NZB with many missing articles; confirm the progress bar advances during parsing and logs show "known not found, skipping" instead of repeated NNTP calls for the same segment IDs

🤖 Generated with Claude Code

javi11 and others added 3 commits March 6, 2026 12:40
…h 430s

- Increase goroutine pool sizes from NumCPU to min(n,20) for I/O-bound
  operations in fetchAllFirstSegments and ParseFile
- Cache segment IDs that returned 430 Not Found and skip redundant NNTP
  calls in normalizeSegmentSizesWithYenc for permanently-missing segments
- Parallelize the 16KB completion loop using errgroup instead of
  sequential fetches
- Add IsArticleNotFound to FirstSegmentData to distinguish permanent 430s
  from transient timeouts
- Advance UpdateDownloadProgress on all error paths in fetchYencHeaders
  and known-404 shortcuts so the metrics tracker never stalls
- Add ProgressTracker parameter to ParseFile; fetchAllFirstSegments ticks
  it atomically per file so the broadcaster-driven UI bar advances from
  0→10% during parsing instead of jumping only at completion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gment bytes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javi11
javi11 merged commit e620b61 into main Mar 6, 2026
2 checks passed
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
…h 430 Not Found (kipsilabs#394)

* perf(parser): improve performance and progress reporting for NZBs with 430s

- Increase goroutine pool sizes from NumCPU to min(n,20) for I/O-bound
  operations in fetchAllFirstSegments and ParseFile
- Cache segment IDs that returned 430 Not Found and skip redundant NNTP
  calls in normalizeSegmentSizesWithYenc for permanently-missing segments
- Parallelize the 16KB completion loop using errgroup instead of
  sequential fetches
- Add IsArticleNotFound to FirstSegmentData to distinguish permanent 430s
  from transient timeouts
- Advance UpdateDownloadProgress on all error paths in fetchYencHeaders
  and known-404 shortcuts so the metrics tracker never stalls
- Add ProgressTracker parameter to ParseFile; fetchAllFirstSegments ticks
  it atomically per file so the broadcaster-driven UI bar advances from
  0→10% during parsing instead of jumping only at completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant