fix session leak
This commit is contained in:
@@ -39,13 +39,13 @@ type SESClient struct {
|
||||
}
|
||||
|
||||
const (
|
||||
defaultExpiration = 5 * time.Minute
|
||||
cleanupInterval = 10 * time.Minute
|
||||
emailRetryExpiration = 5 * time.Minute
|
||||
sesCleanupInterval = 10 * time.Minute
|
||||
)
|
||||
|
||||
func NewSESClient() SESClient {
|
||||
return SESClient{
|
||||
ResetCache: cache.New(defaultExpiration, cleanupInterval),
|
||||
ResetCache: cache.New(emailRetryExpiration, sesCleanupInterval),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func (s *SESClient) SendEmail(email Email) error {
|
||||
Source: aws.String(email.Sender),
|
||||
}
|
||||
|
||||
if err = s.ResetCache.Add(email.Recipient, nil, defaultExpiration); err != nil {
|
||||
if err = s.ResetCache.Add(email.Recipient, nil, emailRetryExpiration); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user