chore: golint
This commit is contained in:
parent
54cc84c5b6
commit
2921bc9869
|
@ -6,6 +6,7 @@ import (
|
|||
useD "app-cloudep-notification-service/pkg/domain/usecase"
|
||||
"app-cloudep-notification-service/pkg/repository"
|
||||
"app-cloudep-notification-service/pkg/usecase"
|
||||
|
||||
"code.30cm.net/digimon/library-go/errs"
|
||||
"code.30cm.net/digimon/library-go/errs/code"
|
||||
)
|
||||
|
@ -75,6 +76,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
|||
}
|
||||
|
||||
uc := usecase.MustDeliveryUseCase(param)
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DeliveryUseCase: uc,
|
||||
|
|
|
@ -2,7 +2,8 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"app-cloudep-notification-service/gen_result/pb/notification"
|
||||
"app-cloudep-notification-service/internal/config"
|
||||
|
@ -34,6 +35,6 @@ func main() {
|
|||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
logx.Infof("Starting rpc server at %s...\n", c.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
|
|
@ -50,9 +50,7 @@ func (use *AwsEmailDeliveryRepository) SendMail(ctx context.Context, req reposit
|
|||
err := use.Pool.Submit(func() {
|
||||
// 設置郵件參數
|
||||
to := make([]string, 0, len(req.To))
|
||||
for _, item := range req.To {
|
||||
to = append(to, item)
|
||||
}
|
||||
to = append(to, req.To...)
|
||||
|
||||
input := &ses.SendEmailInput{
|
||||
Destination: &types.Destination{
|
||||
|
@ -74,9 +72,12 @@ func (use *AwsEmailDeliveryRepository) SendMail(ctx context.Context, req reposit
|
|||
}
|
||||
|
||||
// 發送郵件
|
||||
//TODO 不明原因送不出去,會被 context cancel 這裡先把它手動加到100sec
|
||||
c, _ := context.WithTimeout(context.Background(), 100*time.Second)
|
||||
if _, err := use.Client.SendEmail(c, input); err != nil {
|
||||
// TODO 不明原因送不出去,會被 context cancel 這裡先把它手動加到100sec
|
||||
newCtx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
|
||||
defer cancel()
|
||||
|
||||
//nolint:contextcheck
|
||||
if _, err := use.Client.SendEmail(newCtx, input); err != nil {
|
||||
_ = domain.ThirdPartyErrorL(
|
||||
code.CloudEPNotification,
|
||||
domain.FailedToSendEmailErrorCode,
|
||||
|
|
|
@ -31,7 +31,7 @@ func MustSMTPUseCase(param SMTPMailUseCaseParam) repository.MailRepository {
|
|||
}
|
||||
}
|
||||
|
||||
func (repo *SMTPMailRepository) SendMail(ctx context.Context, req repository.MailReq) error {
|
||||
func (repo *SMTPMailRepository) SendMail(_ context.Context, req repository.MailReq) error {
|
||||
// 用 goroutine pool 送,否則會超時
|
||||
err := repo.Pool.Submit(func() {
|
||||
m := gomail.NewMessage()
|
||||
|
|
Loading…
Reference in New Issue