feat: adds online providers warm up before starting discovery#3235
feat: adds online providers warm up before starting discovery#3235stalniy wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe PR adds online-provider warm-up initialization to the provider discovery service. The repository gains a keyset-paginated streaming method for online providers, the scheduler adds a ChangesOnline Provider Warm-up Initialization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: one or more packages not found in the registry. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3235 +/- ##
==========================================
- Coverage 66.69% 66.06% -0.64%
==========================================
Files 1065 1024 -41
Lines 26123 25110 -1013
Branches 6291 6127 -164
==========================================
- Hits 17423 16588 -835
+ Misses 7602 7437 -165
+ Partials 1098 1085 -13
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/provider-inventory/src/providers-sync-app.ts (1)
31-35:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAbort warm-up streams on warm-up failure to avoid partial startup leakage.
If
warmUp()fails after starting some lifecycle streams, the catch path closes the HTTP server but does not cancel already-started warm-up streams. Add a warm-upAbortControllerand abort it in the catch block before rethrowing.Suggested fix
if (server) { + const scheduler = container.resolve(DiscoverySchedulerService); + const warmUpController = new AbortController(); try { - await container.resolve(DiscoverySchedulerService).warmUp(); - container.resolve(DiscoverySchedulerService).start(); + await scheduler.warmUp(warmUpController.signal); + scheduler.start(); } catch (error) { + warmUpController.abort(); server.close(); throw error; } }🤖 Prompt for 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. In `@apps/provider-inventory/src/providers-sync-app.ts` around lines 31 - 35, The warm-up streams started by DiscoverySchedulerService.warmUp() can leak if warmUp fails because you only close the HTTP server; create an AbortController before calling warmUp(), pass its signal into DiscoverySchedulerService.warmUp(signal) (and any downstream warm-up calls), and in the catch block call abortController.abort() before calling server.close() and rethrowing the error so any started warm-up streams are cancelled; ensure any invocation of DiscoverySchedulerService.start() that relies on warm-up uses the same controller/signal if needed.
🤖 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
`@apps/provider-inventory/src/repositories/provider-inventory/provider-inventory.repository.ts`:
- Line 35: Validate that options?.batchSize is a positive integer before using
it in limit(...) by checking Number.isInteger(batchSize) && batchSize > 0; if
validation fails, fall back to DEFAULT_ONLINE_STREAM_BATCH_SIZE (or throw an
explicit error if that fits the function contract). Update the variable
assignment for batchSize (the constant currently set from options?.batchSize ??
DEFAULT_ONLINE_STREAM_BATCH_SIZE) to perform this guard so the value passed into
the query's limit(...) call is always a safe positive integer.
---
Outside diff comments:
In `@apps/provider-inventory/src/providers-sync-app.ts`:
- Around line 31-35: The warm-up streams started by
DiscoverySchedulerService.warmUp() can leak if warmUp fails because you only
close the HTTP server; create an AbortController before calling warmUp(), pass
its signal into DiscoverySchedulerService.warmUp(signal) (and any downstream
warm-up calls), and in the catch block call abortController.abort() before
calling server.close() and rethrowing the error so any started warm-up streams
are cancelled; ensure any invocation of DiscoverySchedulerService.start() that
relies on warm-up uses the same controller/signal if needed.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 23ecf03c-b351-405a-a42b-b1ffb9b9aa34
📒 Files selected for processing (5)
apps/provider-inventory/src/providers-sync-app.tsapps/provider-inventory/src/repositories/provider-inventory/provider-inventory.repository.spec.tsapps/provider-inventory/src/repositories/provider-inventory/provider-inventory.repository.tsapps/provider-inventory/src/services/discovery-scheduler/discovery-scheduler.service.spec.tsapps/provider-inventory/src/services/discovery-scheduler/discovery-scheduler.service.ts
fd866bd to
892522e
Compare
|
Actionable comments posted: 0 |
Why
ref CON-405
What
Summary by CodeRabbit