summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-13 22:29:49 +0300
committerWolfy-J <[email protected]>2018-06-13 22:29:49 +0300
commitc2a2912242048c9432c111343d2ae16616c6321f (patch)
treee5ff6e9e2349eb81c6cf511b2c019012babba9f7 /service
parent72562187f3802bd0910d6ba0ac73cd1819e5cc19 (diff)
more tests + rpc tests
Diffstat (limited to 'service')
-rw-r--r--service/http/rpc.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/service/http/rpc.go b/service/http/rpc.go
index 38aea2cf..aebc5903 100644
--- a/service/http/rpc.go
+++ b/service/http/rpc.go
@@ -1,5 +1,9 @@
package http
+import (
+ "github.com/pkg/errors"
+)
+
type rpcServer struct{ svc *Service }
// WorkerList contains list of workers.
@@ -25,12 +29,20 @@ type Worker 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.svc.srv == nil {
+ return errors.New("http server is not running")
+ }
+
*r = "OK"
return rpc.svc.rr.Reset()
}
// Workers returns list of active workers and their stats.
func (rpc *rpcServer) Workers(list bool, r *WorkerList) error {
+ if rpc.svc.srv == nil {
+ return errors.New("http server is not running")
+ }
+
for _, w := range rpc.svc.rr.Workers() {
state := w.State()
r.Workers = append(r.Workers, Worker{