Retry peer notification of events (#8621)

master
Krishna Srinivas 5 years ago committed by Harshavardhana
parent 3c30e4503d
commit 3b67f629a4
  1. 15
      cmd/peer-rest-client.go

@ -294,6 +294,21 @@ func (client *peerRESTClient) ListenBucketNotification(bucket string, eventNames
// SendEvent - calls send event RPC.
func (client *peerRESTClient) SendEvent(bucket string, targetID, remoteTargetID event.TargetID, eventData event.Event) error {
numTries := 10
for {
err := client.sendEvent(bucket, targetID, remoteTargetID, eventData)
if err == nil {
return nil
}
if numTries == 0 {
return err
}
numTries--
time.Sleep(5 * time.Second)
}
}
func (client *peerRESTClient) sendEvent(bucket string, targetID, remoteTargetID event.TargetID, eventData event.Event) error {
args := sendEventRequest{
TargetID: remoteTargetID,
Event: eventData,

Loading…
Cancel
Save