[GIT-227] fix: handle missing comment reaction in activity task #9175#9298
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 (1)
📝 WalkthroughWalkthroughIn ChangesComment Reaction Null Guard
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 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 unit tests (beta)
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.
Pull request overview
Fixes a race-condition crash in the issue_activity Celery background task when a comment reaction is deleted before the corresponding activity event is processed. The change makes create_comment_reaction_activity resilient to missing CommentReaction rows by guarding against a None query result.
Changes:
- Avoid unpacking a
Noneresult from.values_list(...).first()by storing the tuple first. - Return early when the reaction record is not found, preventing the task from crashing and allowing the batch to continue.
Description
Bug
The Celery background task
issue_activitycrashes with:when a comment reaction is deleted before the task processes the corresponding event. This creates a race condition where the
CommentReactionrecord no longer exists by the time the worker executes.Root Cause
In
apps/api/plane/bgtasks/issue_activities_task.py,create_comment_reaction_activitydirectly unpacks the result of.first():When the reaction has already been deleted,
.first()returnsNone, causing Python to raise:Fix
Store the query result in a temporary variable and return early when no record is found, following the same guard pattern already used in
create_issue_reaction_activity:This prevents the Celery task from failing when the reaction no longer exists.
Type of Change
Screenshots and Media
N/A
Test Scenarios
TypeErrortraceback.References
Closes #9175
Summary by CodeRabbit
Bug Fixes