Catch DoesNotExist in post_slack_rate_limit_message (#1067)

This commit is contained in:
Vadim Stepanov 2023-01-03 17:44:56 +00:00 committed by GitHub
parent da51edefcc
commit cd770e85ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -467,7 +467,13 @@ def post_or_update_log_report_message_task(alert_group_pk, slack_team_identity_p
)
def post_slack_rate_limit_message(integration_id):
AlertReceiveChannel = apps.get_model("alerts", "AlertReceiveChannel")
integration = AlertReceiveChannel.objects.get(pk=integration_id)
try:
integration = AlertReceiveChannel.objects.get(pk=integration_id)
except AlertReceiveChannel.DoesNotExist:
logger.warning(f"AlertReceiveChannel {integration_id} doesn't exist")
return
if not compare_escalations(post_slack_rate_limit_message.request.id, integration.rate_limit_message_task_id):
logger.info(
f"post_slack_rate_limit_message. integration {integration_id}. ID mismatch. "