Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Lock expiration time

lotk7cab8a50518e
diff --git a/core/internal/service/batch_mail/api_mail_send.go b/core/internal/service/batch_mail/api_mail_send.go
index 6aa1e8fd..31a1653a 100644
--- a/core/internal/service/batch_mail/api_mail_send.go
+++ b/core/internal/service/batch_mail/api_mail_send.go
@@ -150,15 +150,15 @@ func (p *WorkerPool) processMail(ctx context.Context, log ApiMailLog) {
// Queue processing with distributed lock
func ProcessApiMailQueueWithLock(ctx context.Context) {
// Attempt to acquire the distributed lock
- locked, err := g.Redis().SetNX(ctx, LockKey, "1")
+ err := g.Redis().SetEX(ctx, LockKey, "1", LockTimeout)
if err != nil {
g.Log().Error(ctx, "Failed to acquire lock:", err)
return
}
- if !locked {
- g.Log().Warning(ctx, "Another instance is processing the mail queue")
- return
- }
+ //if !locked {
+ // g.Log().Warning(ctx, "Another instance is processing the mail queue")
+ // return
+ //}
// // Set expiration time
// g.Redis().Expire(ctx, LockKey, int64(LockTimeout))