Skip to content

Commit

Permalink
Qed sender: add exponential backoff in sender due to i/o timeouts in AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
iknite committed Feb 27, 2019
1 parent feeb677 commit 23cacf9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions gossip/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,18 @@ func (s Sender) sender(batch protocol.BatchSnapshots) {
dst := peer.Node()
log.Infof("Sending batch %+v to node %+v\n", batch, dst.Name)
wg.Add(1)
// go func() {
err := s.Agent.Memberlist().SendReliable(dst, msg)
if err != nil {
log.Errorf("Failed send message: %v", err)

for retries := uint(0); retries < 5; retries++ {
err := s.Agent.Memberlist().SendReliable(dst, msg)
if err != nil {
if retries == 5 {
log.Errorf("Failed send message: %v", err)
}
delay := (10 << retries) * time.Millisecond
time.Sleep(delay)
continue
}
}
// }()
}
wg.Wait()
log.Infof("Sent batch %+v to nodes %+v\n", batch, peers.L)
Expand Down

0 comments on commit 23cacf9

Please sign in to comment.