mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
fix: improper ticker usage in goroutines (#11468)
- lock maintenance loop was incorrectly sleeping as well as using ticker badly, leading to extra expiration routines getting triggered that could flood the network. - multipart upload cleanup should be based on timer instead of ticker, to ensure that long running jobs don't get triggered twice. - make sure to get right lockers for object name
This commit is contained in:
@@ -92,8 +92,7 @@ func (dm *DRWMutex) Lock(id, source string) {
|
||||
|
||||
// Options lock options.
|
||||
type Options struct {
|
||||
Timeout time.Duration
|
||||
Tolerance int
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
// GetLock tries to get a write lock on dm before the timeout elapses.
|
||||
@@ -155,10 +154,7 @@ func (dm *DRWMutex) lockBlocking(ctx context.Context, id, source string, isReadL
|
||||
defer cancel()
|
||||
|
||||
// Tolerance is not set, defaults to half of the locker clients.
|
||||
tolerance := opts.Tolerance
|
||||
if tolerance == 0 {
|
||||
tolerance = len(restClnts) / 2
|
||||
}
|
||||
tolerance := len(restClnts) / 2
|
||||
|
||||
// Quorum is effectively = total clients subtracted with tolerance limit
|
||||
quorum := len(restClnts) - tolerance
|
||||
|
||||
Reference in New Issue
Block a user