Skip to content
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 race condition #251

Merged
merged 1 commit into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions promgen/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def process_alert(alert_pk):
alert.delete()
return

# After processing our blacklist, it should be safe to queue our
# alert to also index the labels
index_alert.delay(alert.pk)

# Now that we have our routable items, we want to check which senders are
# configured and expand those as needed
senders = collections.defaultdict(set)
Expand Down
1 change: 0 additions & 1 deletion promgen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,6 @@ def post(self, request, *args, **kwargs):
# when we run tasks.process_alert
alert = models.Alert.objects.create(body=request.body.decode("utf-8"))
tasks.process_alert.delay(alert.pk)
tasks.index_alert.delay(alert.pk)
return HttpResponse("OK", status=202)


Expand Down