diff options
author | Wolfy-J <[email protected]> | 2018-06-13 13:10:59 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-13 13:10:59 +0300 |
commit | 436d4bc263137640b4f0a58e27a82619bca10e85 (patch) | |
tree | 6e3ec0d00c804389f916fae3995c37d29442862d /server.go | |
parent | d2c7ee8c0a070b9790d5552d3f607ca01e1ab798 (diff) |
minor improvements
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -127,11 +127,12 @@ func (s *Server) Reconfigure(cfg *ServerConfig) error { s.mu.Unlock() pool, err := NewPool(cfg.makeCommand(), s.factory, *cfg.Pool) - s.pool.Listen(s.poolListener) if err != nil { return err } + s.pool.Listen(s.poolListener) + s.mu.Lock() s.cfg.Pool, s.pool = cfg.Pool, pool s.mu.Unlock() @@ -177,23 +178,22 @@ func (s *Server) Pool() Pool { // AddListener pool events. func (s *Server) poolListener(event int, ctx interface{}) { - // bypassing to user specified lsn - s.throw(event, ctx) - if event == EventPoolError { // pool failure, rebuilding if err := s.Reset(); err != nil { s.mu.Lock() - defer s.mu.Unlock() - s.started = false s.pool = nil s.factory = nil + s.mu.Unlock() // everything is dead, this is recoverable but heavy state s.throw(EventServerFailure, err) } } + + // bypassing to user specified lsn + s.throw(event, ctx) } // throw invokes event handler if any. |