Probe concurrency guardrails and operations#43
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughAdds concurrency guidance and a run_blocking_io helper; makes ISOProber stats lock-protected with snapshot reporting and JSON cycle summaries; normalizes and merges unusable Last-Modified handling into “no-LM”/recent behavior; updates monitor to use snapshot_stats and run_blocking_io; and adds operator docs and tests. ChangesConcurrency Safety & Probe Operations
Sequence DiagramsequenceDiagram
participant EventLoop as asyncio Event Loop
participant Monitor as Monitor.scheduler
participant RunBlocking as run_blocking_io
participant Worker as WorkerThread
participant DB as PostgreSQL
Monitor->>RunBlocking: await run_blocking_io(matches_for_users)
RunBlocking->>Worker: asyncio.to_thread(callable)
Worker->>DB: execute blocking query (own connection)
DB-->>Worker: query result
Worker-->>RunBlocking: return result
RunBlocking-->>Monitor: resume with result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/paperscout/sources.py`:
- Around line 583-593: The broad except Exception around parsedate_to_datetime
should be narrowed to only the exceptions that parsing can raise; replace
"except Exception:" with "except (TypeError, ValueError):" so only bad/invalid
Last-Modified inputs are handled (keeping the existing fallback: last_modified =
None and is_recent = True), and allow other unexpected exceptions to propagate;
look for the parsedate_to_datetime call and the variables last_modified and
is_recent in this block to apply the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 631af90f-8ee8-4e40-adae-a80fa913e7c8
📒 Files selected for processing (9)
CONTRIBUTING.mdREADME.mddocs/architecture.mddocs/probe-operations.mdsrc/paperscout/concurrency.pysrc/paperscout/models.pysrc/paperscout/monitor.pysrc/paperscout/sources.pytests/test_sources.py
|
@coderabbitai full review again |
|
✅ Actions performedFull review triggered. |
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Summary
Closes week_3 issues 07, 08, and 09 in one PR: harden and document the asyncio/thread concurrency model, fix Last-Modified edge cases in ISO probes, and add operator-facing probe documentation plus machine-readable per-cycle logging.
Changes
Issue 37 — Implicit single-thread contract (ISOProber._stats)
Issue 08 — asyncio.to_thread guardrails
Issue 09 — Probe operations + Last-Modified
Test plan
Related Issues
close #37
close #38
close #39
Summary by CodeRabbit
Documentation
Bug Fixes
Refactor
Tests