revert multiple attempt to notify, may cause dbl-posting

This commit is contained in:
Umputun
2018-11-14 11:05:37 -06:00
parent 431d294cb6
commit 3e49972e05
+4 -13
View File
@@ -8,9 +8,6 @@ import (
"sync"
"sync/atomic"
"github.com/go-pkgz/repeater"
"github.com/go-pkgz/repeater/strategy"
"github.com/umputun/remark/backend/app/store"
"github.com/umputun/remark/backend/app/store/service"
)
@@ -94,16 +91,10 @@ func (s *Service) do() {
var wg sync.WaitGroup
for _, dest := range s.destinations {
wg.Add(1)
rpt := repeater.New(strategy.NewBackoff(5, 1.5, true))
go func(d Destination) {
err := rpt.Do(func() error {
return d.Send(s.ctx, c)
})
if err != nil {
log.Printf("[WARN] failed to send to %s, %s", d, err)
}
wg.Done()
}(dest)
if err := dest.Send(s.ctx, c); err != nil {
log.Printf("[WARN] failed to send to %s, %s", dest, err)
}
wg.Done()
}
wg.Wait()
}