split sign and reset

This commit is contained in:
2025-01-30 11:33:16 -06:00
parent 597532bf26
commit 6dd84e4ca3
8 changed files with 441 additions and 47 deletions

View File

@@ -14,6 +14,13 @@ import (
"time"
)
const (
EmailRetryExpiration = 5 * time.Minute
SesCleanupInterval = 10 * time.Minute
EmailQueueBufferSize = 100
MaxEmailsPerSecond = 13
)
type Client interface {
SendEmail(Email) error
}
@@ -36,14 +43,9 @@ type SESClient struct {
ResetCache *cache.Cache
}
const (
emailRetryExpiration = 5 * time.Minute
sesCleanupInterval = 10 * time.Minute
)
func NewSESClient() SESClient {
return SESClient{
ResetCache: cache.New(emailRetryExpiration, sesCleanupInterval),
ResetCache: cache.New(EmailRetryExpiration, SesCleanupInterval),
}
}
@@ -79,7 +81,7 @@ func (s *SESClient) SendEmail(email Email) error {
Source: aws.String(email.Sender),
}
if err = s.ResetCache.Add(email.Recipient, nil, emailRetryExpiration); err != nil {
if err = s.ResetCache.Add(email.Recipient, nil, EmailRetryExpiration); err != nil {
return err
}