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

chore(v1): demote webhook errors to warnings #2980

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
12 changes: 6 additions & 6 deletions services/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ func sendWebhookNotifications(useDB *sqlx.DB) error {
}
resp, err := client.Post(n.Content.Webhook.Url, "application/json", reqBody)
if err != nil {
logger.WithError(err).Errorf("error sending request")
logger.WithError(err).Warnf("error sending request")
} else {
metrics.NotificationsSent.WithLabelValues("webhook", resp.Status).Inc()
}
Expand All @@ -1021,11 +1021,11 @@ func sendWebhookNotifications(useDB *sqlx.DB) error {
if resp != nil {
b, err := io.ReadAll(resp.Body)
if err != nil {
logger.WithError(err).Error("error reading body")
logger.WithError(err).Warn("error reading body")
} else {
errResp.Status = resp.Status
errResp.Body = string(b)
}

errResp.Status = resp.Status
errResp.Body = string(b)
}

_, err = useDB.Exec(`UPDATE users_webhooks SET retries = retries + 1, last_sent = now(), request = $2, response = $3 WHERE id = $1;`, n.Content.Webhook.ID, n.Content, errResp)
Expand Down Expand Up @@ -1140,7 +1140,7 @@ func sendDiscordNotifications(useDB *sqlx.DB) error {
if strings.Contains(errResp.Body, "You are being rate limited") {
logger.Warnf("could not push to discord webhook due to rate limit. %v url: %v", errResp.Body, webhook.Url)
} else {
utils.LogError(nil, "error pushing discord webhook", 0, map[string]interface{}{"errResp.Body": errResp.Body, "webhook.Url": webhook.Url})
utils.LogWarn(nil, "error pushing discord webhook", 0, map[string]interface{}{"errResp.Body": errResp.Body, "webhook.Url": webhook.Url})
}
_, err = useDB.Exec(`UPDATE users_webhooks SET request = $2, response = $3 WHERE id = $1;`, webhook.ID, reqs[i].Content.DiscordRequest, errResp)
if err != nil {
Expand Down
Loading