-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Notifications stuck in queue, no way to purge. #8525
Comments
Hey @showingtime-devops, There might be some hints in your logs that could explain why these notifications are stuck in pending - I expect it's likely related to some sort of bug or side effect of a service restart. If anybody wants to take a stab at improving this, there's a few things we could do to address this in terms of cleanup.
Does a patch like this work for you? If so, we could turn it into a PR: diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py
index df138b8a6d..87a12a7d51 100644
--- a/awx/api/views/__init__.py
+++ b/awx/api/views/__init__.py
@@ -4257,7 +4257,9 @@ class NotificationTemplateDetail(RetrieveUpdateDestroyAPIView):
obj = self.get_object()
if not request.user.can_access(self.model, 'delete', obj):
return Response(status=status.HTTP_404_NOT_FOUND)
- if obj.notifications.filter(status='pending').exists():
+
+ recent = now() - dateutil.relativedelta.relativedelta(hours=8)
+ if obj.notifications.filter(status='pending', created__gt=recent).exists():
return Response({"error": _("Delete not allowed while there are pending notifications")},
status=status.HTTP_405_METHOD_NOT_ALLOWED)
return super(NotificationTemplateDetail, self).delete(request, *args, **kwargs) |
Hi @ryanpetrello , Option 2 works for me. I really don't need a job notification from last year 😄 |
I could fix it by deleting the pending notification via psql CLI: |
ISSUE TYPE
SUMMARY
I have 200 notifications stuck in queue with no way to remove them and I cannot delete the notification template.
ENVIRONMENT
STEPS TO REPRODUCE
N/A
EXPECTED RESULTS
Expect to be able to resend or purge old notifications.
ACTUAL RESULTS
No way to resend or purge old notifications.
ADDITIONAL INFORMATION
Error Message when attempting to delete Notification Template in AWX Web UI
The text was updated successfully, but these errors were encountered: