mirror of https://github.com/minio/minio.git
				
				
				
			fix: maxConcurrent '0' is an invalid value (#15500)
log and continue with defaults instead of crashing the service.
This commit is contained in:
		
							parent
							
								
									6a6c772ff2
								
							
						
					
					
						commit
						ecdc2f2f5f
					
				| 
						 | 
					@ -23,7 +23,6 @@ import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"math/rand"
 | 
						"math/rand"
 | 
				
			||||||
	"os"
 | 
					 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
| 
						 | 
					@ -32,6 +31,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/minio/madmin-go"
 | 
						"github.com/minio/madmin-go"
 | 
				
			||||||
	"github.com/minio/minio/internal/logger"
 | 
						"github.com/minio/minio/internal/logger"
 | 
				
			||||||
 | 
						"github.com/minio/pkg/env"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//go:generate stringer -type=storageMetric -trimprefix=storageMetric $GOFILE
 | 
					//go:generate stringer -type=storageMetric -trimprefix=storageMetric $GOFILE
 | 
				
			||||||
| 
						 | 
					@ -575,12 +575,11 @@ const (
 | 
				
			||||||
var diskMaxConcurrent = 512
 | 
					var diskMaxConcurrent = 512
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	if s, ok := os.LookupEnv("_MINIO_DISK_MAX_CONCURRENT"); ok && s != "" {
 | 
						s := env.Get("_MINIO_DISK_MAX_CONCURRENT", "512")
 | 
				
			||||||
		var err error
 | 
						diskMaxConcurrent, _ = strconv.Atoi(s)
 | 
				
			||||||
		diskMaxConcurrent, err = strconv.Atoi(s)
 | 
						if diskMaxConcurrent <= 0 {
 | 
				
			||||||
		if err != nil {
 | 
							logger.LogIf(GlobalContext, fmt.Errorf("invalid _MINIO_DISK_MAX_CONCURRENT value: %s, defaulting to '512'", s))
 | 
				
			||||||
			logger.Fatal(err, "invalid _MINIO_DISK_MAX_CONCURRENT value")
 | 
							diskMaxConcurrent = 512
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue