diff options
author | Wolfy-J <[email protected]> | 2018-05-29 13:23:06 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-05-29 13:23:06 +0300 |
commit | e45daa3bbfd5e95889d00ba3cf9ff6c95101bcb2 (patch) | |
tree | d1fe2ed0b1284fbad98328e9c5aaf0da76b56877 /server.go | |
parent | c91f297320f281b32d5d70a7b570caf94ead0e2e (diff) |
fixing tests
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -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 } |