Avoid config reload all the time, reload is manually triggerred from outside

This commit is contained in:
Harshavardhana
2015-07-06 16:26:54 -07:00
parent 8b94c53345
commit b029d0a5f0
27 changed files with 2904 additions and 140 deletions

View File

@@ -21,6 +21,7 @@ import (
"fmt"
"net"
"net/http"
"os"
"strings"
"github.com/minio/minio/pkg/iodine"
@@ -28,12 +29,6 @@ import (
"github.com/minio/minio/pkg/server/nimble"
)
// startServices start all services
func startServices(errCh chan error, servers ...*http.Server) {
defer close(errCh)
errCh <- nimble.ListenAndServe(servers...)
}
// getAPI server instance
func getAPIServer(conf api.Config, apiHandler http.Handler) (*http.Server, error) {
// Minio server config
@@ -83,9 +78,9 @@ func getAPIServer(conf api.Config, apiHandler http.Handler) (*http.Server, error
for _, host := range hosts {
if conf.TLS {
fmt.Printf("Starting minio server on: https://%s:%s\n", host, port)
fmt.Printf("Starting minio server on: https://%s:%s, PID: %d\n", host, port, os.Getpid())
} else {
fmt.Printf("Starting minio server on: http://%s:%s\n", host, port)
fmt.Printf("Starting minio server on: http://%s:%s, PID: %d\n", host, port, os.Getpid())
}
}
@@ -113,21 +108,18 @@ func startTM(a api.Minio) {
}
// StartServices starts basic services for a server
func StartServices(conf api.Config, doneCh chan struct{}) error {
errCh := make(chan error)
func StartServices(conf api.Config) error {
apiHandler, minioAPI := getAPIHandler(conf)
apiServer, err := getAPIServer(conf, apiHandler)
if err != nil {
return iodine.New(err, nil)
}
rpcServer := getRPCServer(getRPCHandler())
go startServices(errCh, apiServer, rpcServer)
// start ticket master
go startTM(minioAPI)
select {
case err := <-errCh:
if err := nimble.ListenAndServe(apiServer, rpcServer); err != nil {
return iodine.New(err, nil)
case <-doneCh:
return nil
}
return nil
}