-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[WEB-5228] chore: IssueLink.DoesNotExist on crawl_work_item_link_title #8003
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
Conversation
WalkthroughAdded try/except around Changes
Sequence Diagram(s)sequenceDiagram
participant Scheduler
participant Task as crawl_work_item_link_title
participant DB as IssueLink.objects.get
Scheduler->>Task: enqueue / trigger
Task->>DB: get(issue_link_id)
alt IssueLink exists
DB-->>Task: IssueLink instance
Task->>Task: assign metadata\nsave()
Task-->>Scheduler: complete
else DoesNotExist
DB-->>Task: DoesNotExist
Task->>Task: log warning\nreturn early
Task-->>Scheduler: complete (early)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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. Comment |
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
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 (2)
apps/api/plane/bgtasks/work_item_link_task.py (2)
175-179: Include the id in the log message for better debugging.The log message should include the
idparameter to help trace which IssueLink was not found, especially when investigating issues.Apply this diff to improve the log message:
- logger.info("IssueLink not found") + logger.info(f"IssueLink not found for id: {id}")
173-182: Consider validating meta_data before saving to avoid persisting error states.The
crawl_work_item_link_title_and_faviconfunction returns a dict with an"error"key when crawling fails (lines 78-83). Currently, this error response would be saved to the database. Consider checking if the crawl was successful before persisting the metadata.Apply this diff to validate the metadata before saving:
meta_data = crawl_work_item_link_title_and_favicon(url) + + # Skip saving if crawling failed + if "error" in meta_data: + logger.warning(f"Failed to crawl link metadata for IssueLink {id}: {meta_data.get('error')}") + return try: issue_link = IssueLink.objects.get(id=id) except IssueLink.DoesNotExist: - logger.info("IssueLink not found") + logger.info(f"IssueLink not found for id: {id}") return issue_link.metadata = meta_data issue_link.save()
Description
Added a try-except block on crawl_work_item_link_title, which handles DoesNotExist error for IssueLink
Type of Change
References
Sentry
Summary by CodeRabbit