mirror of
https://github.com/minio/minio.git
synced 2025-12-01 22:02:33 -05:00
remove unnecessary logging and move to log once (#10798)
the current master logs way too much when a node is down, instead log once and move on.
This commit is contained in:
@@ -18,6 +18,8 @@ package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"time"
|
||||
@@ -77,5 +79,19 @@ var logOnce = newLogOnceType()
|
||||
// id is a unique identifier for related log messages, refer to cmd/notification.go
|
||||
// on how it is used.
|
||||
func LogOnceIf(ctx context.Context, err error, id interface{}, errKind ...interface{}) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, http.ErrServerClosed) {
|
||||
return
|
||||
}
|
||||
|
||||
if e := errors.Unwrap(err); e != nil {
|
||||
if e.Error() == "disk not found" {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
logOnce.logOnceIf(ctx, err, id, errKind...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user