summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-05-29 13:23:06 +0300
committerWolfy-J <[email protected]>2018-05-29 13:23:06 +0300
commite45daa3bbfd5e95889d00ba3cf9ff6c95101bcb2 (patch)
treed1fe2ed0b1284fbad98328e9c5aaf0da76b56877 /server.go
parentc91f297320f281b32d5d70a7b570caf94ead0e2e (diff)
fixing tests
Diffstat (limited to 'server.go')
-rw-r--r--server.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/server.go b/server.go
index aba6a5e4..829d0ceb 100644
--- a/server.go
+++ b/server.go
@@ -84,22 +84,18 @@ func (r *Server) Observe(o func(event int, ctx interface{})) {
}
// Pool returns active pool or error.
-func (r *Server) Pool() (Pool, error) {
+func (r *Server) Pool() (Pool) {
r.mu.Lock()
defer r.mu.Unlock()
- if r.pool == nil {
- return nil, fmt.Errorf("no associated pool")
- }
-
- return r.pool, nil
+ return r.pool
}
// Exec one task with given payload and context, returns result or error.
func (r *Server) Exec(rqs *Payload) (rsp *Payload, err error) {
- pool, err := r.Pool()
- if err != nil {
- return nil, err
+ pool := r.Pool()
+ if pool == nil {
+ return nil, fmt.Errorf("no associared pool")
}
return pool.Exec(rqs)
@@ -107,8 +103,8 @@ func (r *Server) Exec(rqs *Payload) (rsp *Payload, err error) {
// Workers returns worker list associated with the pool.
func (r *Server) Workers() (workers []*Worker) {
- pool, err := r.Pool()
- if err != nil {
+ pool := r.Pool()
+ if pool == nil {
return nil
}