mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 23:33:30 +03:00
Don't close socket while re-initializing notify-listeners, as the rpc client object is shared between notify-listeners and peer clients. Also, improves SendRPC() readability by using GetPeerClient().
This commit is contained in:
committed by
Harshavardhana
parent
334cdb5d64
commit
d02cb963d5
@@ -322,7 +322,11 @@ func (api objectAPIHandlers) ListenBucketNotificationHandler(w http.ResponseWrit
|
||||
nEventCh := make(chan []NotificationEvent)
|
||||
defer close(nEventCh)
|
||||
// Add channel for listener events
|
||||
globalEventNotifier.AddListenerChan(accountARN, nEventCh)
|
||||
if err = globalEventNotifier.AddListenerChan(accountARN, nEventCh); err != nil {
|
||||
errorIf(err, "Error adding a listener!")
|
||||
writeErrorResponse(w, r, toAPIErrorCode(err), r.URL.Path)
|
||||
return
|
||||
}
|
||||
// Remove listener channel after the writer has closed or the
|
||||
// client disconnected.
|
||||
defer globalEventNotifier.RemoveListenerChan(accountARN)
|
||||
|
||||
Reference in New Issue
Block a user