Skip to content

Commit abc1ba9

Browse files
committed
v6.2 broadcast circuit breaker msg
1 parent e378965 commit abc1ba9

4 files changed

Lines changed: 22 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [6.2] - 2025-09-08
6+
7+
- Fix circuit breaker error message in broadcast pause reason
8+
- Simplify broadcast circuit breaker notification email
9+
510
## [6.1] - 2025-09-07
611

712
- hide menu items in console when user doesn't have access to the resource

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/spf13/viper"
1111
)
1212

13-
const VERSION = "6.1"
13+
const VERSION = "6.2"
1414

1515
type Config struct {
1616
Server ServerConfig

internal/service/broadcast/orchestrator.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,18 @@ func (o *BroadcastOrchestrator) Process(ctx context.Context, task *domain.Task,
395395
// Defer function to mark broadcast as failed if we're returning an error on the last retry
396396
defer func() {
397397
if err != nil && isLastRetry && broadcastID != "" {
398+
// Check if the error is a circuit breaker error - don't mark as failed in that case
399+
if broadcastErr, ok := err.(*BroadcastError); ok && broadcastErr.Code == ErrCodeCircuitOpen {
400+
o.logger.WithFields(map[string]interface{}{
401+
"task_id": task.ID,
402+
"broadcast_id": broadcastID,
403+
"retry_count": task.RetryCount,
404+
"max_retries": task.MaxRetries,
405+
"error": err.Error(),
406+
}).Info("Task failed due to circuit breaker - broadcast already paused, not marking as failed")
407+
return
408+
}
409+
398410
o.logger.WithFields(map[string]interface{}{
399411
"task_id": task.ID,
400412
"broadcast_id": broadcastID,

pkg/mailer/mailer.go

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -211,28 +211,13 @@ func (m *SMTPMailer) SendCircuitBreakerAlert(email, workspaceName, broadcastName
211211
<body>
212212
<h1 style="color: #d32f2f;">🚨 Broadcast Automatically Paused</h1>
213213
<p>Hello,</p>
214-
<p>Your broadcast <strong>"%s"</strong> in workspace <strong>%s</strong> has been automatically paused due to sending limits being reached.</p>
215-
214+
<p>Your broadcast <strong>"%s"</strong> in workspace <strong>%s</strong> has been automatically paused.</p>
215+
216216
<div style="background-color: #fff3cd; border: 1px solid #ffeaa7; padding: 15px; border-radius: 5px; margin: 20px 0;">
217217
<h3 style="color: #856404; margin-top: 0;">Reason:</h3>
218218
<p style="margin-bottom: 0; color: #856404;"><strong>%s</strong></p>
219219
</div>
220-
221-
<h3>What happened?</h3>
222-
<p>Your email service provider has indicated that you've reached your daily sending limits. To protect your sender reputation and prevent further issues, we've automatically paused your broadcast.</p>
223-
224-
<h3>What should you do?</h3>
225-
<ul>
226-
<li>Wait for your daily sending limits to reset (usually at midnight in your provider's timezone)</li>
227-
<li>Check your email provider's dashboard for more details about your sending limits</li>
228-
<li>Resume the broadcast once your limits have been reset</li>
229-
<li>Consider upgrading your email provider plan if you frequently hit these limits</li>
230-
</ul>
231-
232-
<p>You can resume the broadcast from your Notifuse dashboard once the sending limits have been reset.</p>
233-
234-
<p>If you have any questions, please contact our support team.</p>
235-
220+
236221
<p>Best regards,<br>The Notifuse Team</p>
237222
</body>
238223
</html>`, broadcastName, workspaceName, reason)
@@ -243,23 +228,10 @@ func (m *SMTPMailer) SendCircuitBreakerAlert(email, workspaceName, broadcastName
243228
244229
Hello,
245230
246-
Your broadcast "%s" in workspace %s has been automatically paused due to sending limits being reached.
231+
Your broadcast "%s" in workspace %s has been automatically paused.
247232
248233
REASON: %s
249234
250-
What happened?
251-
Your email service provider has indicated that you've reached your daily sending limits. To protect your sender reputation and prevent further issues, we've automatically paused your broadcast.
252-
253-
What should you do?
254-
- Wait for your daily sending limits to reset (usually at midnight in your provider's timezone)
255-
- Check your email provider's dashboard for more details about your sending limits
256-
- Resume the broadcast once your limits have been reset
257-
- Consider upgrading your email provider plan if you frequently hit these limits
258-
259-
You can resume the broadcast from your Notifuse dashboard once the sending limits have been reset.
260-
261-
If you have any questions, please contact our support team.
262-
263235
Best regards,
264236
The Notifuse Team`, broadcastName, workspaceName, reason)
265237

0 commit comments

Comments
 (0)