mirror of
https://github.com/nikoksr/notify.git
synced 2025-04-11 11:41:58 +02:00
chore(code): clean up a little
This commit is contained in:
parent
20ec590e87
commit
c6054bc20a
19
send.go
19
send.go
@ -12,16 +12,21 @@ func (n *Notify) send(ctx context.Context, subject, message string) error {
|
||||
if n.Disabled {
|
||||
return nil
|
||||
}
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
var eg errgroup.Group
|
||||
|
||||
for _, service := range n.notifiers {
|
||||
if service != nil {
|
||||
s := service
|
||||
eg.Go(func() error {
|
||||
return s.Send(ctx, subject, message)
|
||||
})
|
||||
if service == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
service := service
|
||||
eg.Go(func() error {
|
||||
return service.Send(ctx, subject, message)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
err := eg.Wait()
|
||||
@ -39,5 +44,5 @@ func (n *Notify) Send(ctx context.Context, subject, message string) error {
|
||||
|
||||
// Send calls the underlying notification services to send the given subject and message to their respective endpoints.
|
||||
func Send(ctx context.Context, subject, message string) error {
|
||||
return std.send(ctx, subject, message)
|
||||
return std.Send(ctx, subject, message)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user