mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
allow caller context during reloads() to cancel (#19687)
canceled callers might linger around longer, can potentially overwhelm the system. Instead provider a caller context and canceled callers don't hold on to them. Bonus: we have no reason to cache errors, we should never cache errors otherwise we can potentially have quorum errors creeping in unexpectedly. We should let the cache when invalidating hit the actual resources instead.
This commit is contained in:
@@ -99,7 +99,7 @@ type xlStorageDiskIDCheck struct {
|
||||
func (p *xlStorageDiskIDCheck) getMetrics() DiskMetrics {
|
||||
p.metricsCache.InitOnce(5*time.Second,
|
||||
cachevalue.Opts{},
|
||||
func() (DiskMetrics, error) {
|
||||
func(ctx context.Context) (DiskMetrics, error) {
|
||||
diskMetric := DiskMetrics{
|
||||
LastMinute: make(map[string]AccElem, len(p.apiLatencies)),
|
||||
APICalls: make(map[string]uint64, len(p.apiCalls)),
|
||||
@@ -114,7 +114,7 @@ func (p *xlStorageDiskIDCheck) getMetrics() DiskMetrics {
|
||||
},
|
||||
)
|
||||
|
||||
diskMetric, _ := p.metricsCache.Get()
|
||||
diskMetric, _ := p.metricsCache.GetWithCtx(context.Background())
|
||||
// Do not need this value to be cached.
|
||||
diskMetric.TotalErrorsTimeout = p.totalErrsTimeout.Load()
|
||||
diskMetric.TotalErrorsAvailability = p.totalErrsAvailability.Load()
|
||||
|
||||
Reference in New Issue
Block a user