Skip to content

Commit

Permalink
Another round at re-factoring this.
Browse files Browse the repository at this point in the history
  • Loading branch information
edevil committed Feb 14, 2013
1 parent 878fa81 commit e17705c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pycassa/pool.py
Expand Up @@ -566,17 +566,18 @@ def get(self):
conn = self._q.get(block, timeout)
except Queue.Empty:
conn = self._new_if_required(self._max_conns)
if not conn:
self._notify_on_pool_max(pool_max=self._max_conns)
size_msg = "size %d" % (self._pool_size, )
if self._overflow_enabled:
size_msg += "overflow %d" % (self._max_overflow)
message = "ConnectionPool limit of %s reached, unable to obtain connection after %d seconds" \
% (size_msg, self.pool_timeout)
raise NoConnectionAvailable(message)
else:
conn._checkout()

if not conn:
self._notify_on_pool_max(pool_max=self._max_conns)
size_msg = "size %d" % (self._pool_size, )
if self._overflow_enabled:
size_msg += "overflow %d" % (self._max_overflow)
message = "ConnectionPool limit of %s reached, unable to obtain connection after %d seconds" \
% (size_msg, self.pool_timeout)
raise NoConnectionAvailable(message)

if self._pool_threadlocal:
self._tlocal.current = conn
self._notify_on_checkout(conn)
Expand Down

0 comments on commit e17705c

Please sign in to comment.