mirror of
https://github.com/minio/minio.git
synced 2025-11-28 05:04:14 -05:00
Enable event persistence in webhook (#7614)
This commit is contained in:
committed by
Nitish Tiwari
parent
0ebbd3caef
commit
bb871a7c31
@@ -19,7 +19,10 @@ package target
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio/pkg/event"
|
||||
@@ -76,6 +79,18 @@ func replayEvents(store Store, doneCh <-chan struct{}) <-chan string {
|
||||
return eventKeyCh
|
||||
}
|
||||
|
||||
// isConnResetErr - Checks for connection reset errors.
|
||||
func isConnResetErr(err error) bool {
|
||||
if opErr, ok := err.(*net.OpError); ok {
|
||||
if syscallErr, ok := opErr.Err.(*os.SyscallError); ok {
|
||||
if syscallErr.Err == syscall.ECONNRESET {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// sendEvents - Reads events from the store and re-plays.
|
||||
func sendEvents(target event.Target, eventKeyCh <-chan string, doneCh <-chan struct{}) {
|
||||
retryTimer := time.NewTimer(retryInterval)
|
||||
@@ -88,7 +103,7 @@ func sendEvents(target event.Target, eventKeyCh <-chan string, doneCh <-chan str
|
||||
break
|
||||
}
|
||||
|
||||
if err != errNotConnected {
|
||||
if err != errNotConnected && !isConnResetErr(err) {
|
||||
panic(fmt.Errorf("target.Send() failed with '%v'", err))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user