diff options
Diffstat (limited to 'http/rpc.go')
-rw-r--r-- | http/rpc.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/http/rpc.go b/http/rpc.go index dcf19b1f..38db9a61 100644 --- a/http/rpc.go +++ b/http/rpc.go @@ -3,6 +3,7 @@ package http import ( "github.com/sirupsen/logrus" "github.com/spiral/roadrunner/utils" + "github.com/pkg/errors" ) type rpcServer struct { @@ -17,14 +18,27 @@ type WorkerList struct { // Reset resets underlying RR worker pool and restarts all of it's workers. func (rpc *rpcServer) Reset(reset bool, r *string) error { + if rpc.service.srv == nil { + return errors.New("no http server") + } + logrus.Info("http: restarting worker pool") *r = "OK" - return rpc.service.srv.rr.Reset() + err := rpc.service.srv.rr.Reset() + if err != nil { + logrus.Errorf("http: %s", err) + } + + return err } // Workers returns list of active workers and their stats. func (rpc *rpcServer) Workers(list bool, r *WorkerList) error { + if rpc.service.srv == nil { + return errors.New("no http server") + } + r.Workers = utils.FetchWorkers(rpc.service.srv.rr) return nil } |