File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,8 @@ func FetchAdminEmails() ([]string, error) {
1313 admin := "ADMIN"
1414 err := db .DB .
1515 Model (& models.User {}).
16- Where (& models.User {UserLevel : & admin }).
16+ Where (& models.User {UserLevel : & admin }). // can add super_admin too
1717 Pluck ("user_email" , & emails ).Error
18-
1918 if err != nil {
2019 return nil , err
2120 }
Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ type EmailService interface {
3535
3636type AsyncEmailService struct {
3737 queue chan EmailData
38- from string // From address shown in emails
39- user string // SMTP username (may differ from from)
38+ from string
39+ user string
4040 pass string
4141 host string
4242 port int
4343 logger * zap.Logger
4444 wg sync.WaitGroup
45- mu sync.Mutex // protects running/closed
45+ mu sync.Mutex
4646 running bool
4747 closed bool
4848
@@ -209,16 +209,13 @@ func (s *AsyncEmailService) doSend(job EmailData) error {
209209 }
210210}
211211
212- // ctx allows timeout for shutdown.
213212func (s * AsyncEmailService ) Stop (ctx context.Context ) error {
214213 s .mu .Lock ()
215214 if s .closed {
216215 s .mu .Unlock ()
217216 return nil
218217 }
219- // mark closed so Queue() returns error
220218 s .closed = true
221- // close queue to signal workers to finish
222219 close (s .queue )
223220 s .mu .Unlock ()
224221
You can’t perform that action at this time.
0 commit comments