-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skip duplicate errors during update of readings job #4540
Conversation
📝 WalkthroughWalkthroughThe pull request updates the Changes
Sequence Diagram(s)sequenceDiagram
participant BP as BatchProcessor
participant Doc as Document
participant Log as Logger
Note over BP: Begin processing document
BP->>Doc: Retrieve document
Note right of BP: Process document
alt Duplicate key error (code 11000)
BP->>Log: (Optional) Log warning message
BP-->>BP: Return early, skip document processing
else Other error
BP->>Log: Log error details
BP-->>BP: Rethrow error for further handling
end
Possibly related PRs
Poem
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## staging #4540 +/- ##
===========================================
- Coverage 11.45% 11.45% -0.01%
===========================================
Files 155 155
Lines 18832 18834 +2
Branches 549 549
===========================================
Hits 2158 2158
- Misses 16670 16672 +2
Partials 4 4
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/device-registry/bin/jobs/v2.1-store-readings-job.js (1)
120-124
: The duplicate key error handling looks good!This change successfully implements the PR objective of skipping duplicate errors during the update of readings job. The code now correctly identifies MongoDB error code 11000 (duplicate key error) and returns early without throwing the error, allowing batch processing to continue smoothly.
A few suggestions for consideration:
The logger statement is commented out. Consider either uncommenting it for better observability or removing it entirely if you don't need to track these skipped documents.
There's already duplicate key error handling in the
fetchAndStoreDataIntoReadingsModel
function (lines 258-270). Since you're now handling these errors earlier in the process flow, you might want to review if both error handling mechanisms are necessary or if they could be consolidated.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/device-registry/bin/jobs/v2.1-store-readings-job.js
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build-push-deploy-device-registry
- GitHub Check: Analyze (javascript)
Device registry changes in this PR available for preview here |
Description
skip duplicate errors during update of readings job
Changes Made
Testing
Affected Services
API Documentation Updated?
Summary by CodeRabbit