Skip to content

perf(spiders): non-blocking async file I/O for cache + checkpoint (#32 #34)#54

Merged
Liohtml merged 1 commit into
masterfrom
claude/async-file-io
Jun 24, 2026
Merged

perf(spiders): non-blocking async file I/O for cache + checkpoint (#32 #34)#54
Liohtml merged 1 commit into
masterfrom
claude/async-file-io

Conversation

@Liohtml

@Liohtml Liohtml commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

ResponseCache and CheckpointManager did synchronous std::fs I/O while invoked from async contexts — the cache inside per-request tokio::spawn tasks (#32) and the checkpoint in the main crawl loop (#34) — blocking Tokio worker threads on disk I/O.

  • get / restoretokio::fs async reads.
  • put / save keep the atomic NamedTempFile::persist write (Windows-correct, from upstream-sync: atomic writes for checkpoint and dev-cache files #31) but run it on the blocking pool via tokio::task::spawn_blocking, since tempfile has no async API. This avoids stalling a worker while preserving atomicity.
  • cleanuptokio::fs::remove_file.
  • Engine call sites and the cache/checkpoint unit tests updated to .await (#[tokio::test]).

Test plan

  • cache/checkpoint roundtrip + overwrite + cleanup tests pass as #[tokio::test]
  • cargo test, clippy --all-targets -D warnings, fmt --check all green

Closes #32
Closes #34


Generated by Claude Code

#32/#34: ResponseCache and CheckpointManager performed synchronous std::fs
I/O while called from async contexts (cache inside tokio::spawn per request;
checkpoint in the main crawl loop), blocking Tokio worker threads.

- get/restore now use tokio::fs (async reads).
- put/save remain atomic (NamedTempFile::persist) but run on the blocking
  pool via spawn_blocking, since the temp-file API has no async variant —
  this keeps the Windows-correct atomic replace without stalling a worker.
- cleanup uses tokio::fs::remove_file.
- Engine call sites and the cache/checkpoint unit tests updated to .await.

Closes #32
Closes #34

https://claude.ai/code/session_012RmdaovmNWZVAim4XxCWwn
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Liohtml, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 7 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c4582e0f-555e-408c-855b-700682fd46ac

📥 Commits

Reviewing files that changed from the base of the PR and between 47ac3ce and d07faee.

📒 Files selected for processing (3)
  • src/spiders/cache.rs
  • src/spiders/checkpoint.rs
  • src/spiders/engine.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/async-file-io

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Liohtml Liohtml merged commit eb19302 into master Jun 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants