mirror of
https://github.com/pgsty/minio.git
synced 2026-03-16 17:53:43 +01:00
avoid close 'nil' panics if any (#18890)
brings a generic implementation that prints a stack trace for 'nil' channel closes(), if not safely closes it.
This commit is contained in:
@@ -1237,7 +1237,7 @@ func (s *peerRESTServer) ConsoleLogHandler(w http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
|
||||
doneCh := make(chan struct{})
|
||||
defer close(doneCh)
|
||||
defer xioutil.SafeClose(doneCh)
|
||||
|
||||
ch := make(chan log.Info, 100000)
|
||||
err := globalConsoleSys.Subscribe(ch, doneCh, "", 0, madmin.LogMaskAll, nil)
|
||||
@@ -1298,7 +1298,7 @@ func (s *peerRESTServer) GetBandwidth(w http.ResponseWriter, r *http.Request) {
|
||||
bucketsString := r.Form.Get("buckets")
|
||||
|
||||
doneCh := make(chan struct{})
|
||||
defer close(doneCh)
|
||||
defer xioutil.SafeClose(doneCh)
|
||||
|
||||
selectBuckets := b.SelectBuckets(strings.Split(bucketsString, ",")...)
|
||||
report := globalBucketMonitor.GetReport(selectBuckets)
|
||||
|
||||
Reference in New Issue
Block a user