Add an option to make bucket notifications synchronous (#17406)

With the current asynchronous behaviour in sending notification events
to the targets, we can't provide guaranteed delivery as the systems
might go for restarts.

For such event-driven use-cases, we can provide an option to enable
synchronous events where the APIs wait until the event is successfully
sent or persisted.

This commit adds 'MINIO_API_SYNC_EVENTS' env which when set to 'on'
will enable sending/persisting events to targets synchronously.
This commit is contained in:
Praveen raj Mani
2023-06-21 06:08:59 +05:30
committed by GitHub
parent 02c2ec3027
commit 7c72b25ef0
8 changed files with 74 additions and 60 deletions

View File

@@ -51,10 +51,6 @@ func handleSignals() {
// send signal to various go-routines that they need to quit.
cancelGlobalContext()
if globalEventNotifier != nil {
globalEventNotifier.RemoveAllRemoteTargets()
}
if httpServer := newHTTPServerFn(); httpServer != nil {
err = httpServer.Shutdown()
if !errors.Is(err, http.ErrServerClosed) {
@@ -71,6 +67,10 @@ func handleSignals() {
logger.LogIf(context.Background(), srv.Shutdown())
}
if globalEventNotifier != nil {
globalEventNotifier.RemoveAllBucketTargets()
}
return (err == nil && oerr == nil)
}