-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix(workflow): Add locks to groupowners to prevent duplicates #29309
Conversation
src/sentry/tasks/post_process.py
Outdated
GroupOwner.objects.bulk_create(new_group_owners) | ||
lock = locks.get(f"groupowner-bulk:{group.id}", duration=10) | ||
try: | ||
with lock.acquire(): |
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.
I'd recommend putting this lock around the entire block that is used to calculate new_group_owners
, since that's where the duplication happens as well. Basically the same spot where we start using the timer.
src/sentry/tasks/post_process.py
Outdated
with lock.acquire(): | ||
with metrics.timer("post_process.handle_group_owners"): |
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.
Nit: You can combine with
statements together like
with lock.acquire(), metrics.timer("post_process.handle_group_owners"):
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.
no way
FIXES SENTRY-MP8
There's a race condition on creating group owners when there are multiple tasks. This adds a lock and should deduplicate extras?