-
Notifications
You must be signed in to change notification settings - Fork 299
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 Slack acknowledgment reminders #2769
Conversation
# NOTE: we should probably migrate this field to models.UUIDField as it's ONLY ever being | ||
# set to the result of uuid.uuid1 | ||
last_unique_unacknowledge_process_id: UUID | None = models.CharField(max_length=100, null=True, default=None) |
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.
last_unique_unacknowledge_process_id
should be a string, so removing these type annotations and comments
@@ -1599,28 +1594,20 @@ def bulk_silence(user: User, alert_groups: "QuerySet[AlertGroup]", silence_delay | |||
AlertGroup._bulk_silence(user, root_alert_groups_to_silence, silence_delay) | |||
AlertGroup._bulk_silence(user, dependent_alert_groups_to_silence, silence_delay) | |||
|
|||
def start_ack_reminder(self, user: User): |
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.
user
was only used for logging, so removing it from the args
if not countdown: | ||
return | ||
|
||
self.last_unique_unacknowledge_process_id = celery_uuid() |
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.
The main change of the PR: instead of using uuid1
to generate Celery task IDs, use celery.uuid
.
The method stopped working after we upgraded to kombu 5.3.0 (a transitive dependency of celery). Previously, when UUID
objects were passed to Celery tasks as arguments, they were converted to str
and it was safe to compare it with strings. After upgrading to kombu 5.3.0, UUIDs are passed to tasks as UUID
type, thus comparing them with strings always returns False
.
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.
LGTM
What this PR does
Fixes a bug with Slack acknowledgment reminders not being sent (+ some refactoring and unit tests).
Which issue(s) this PR fixes
#2756
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)