split sign and reset
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user