Permalink
Browse files

When maxsize is not None and create umemcache client fails(server dow…

…n or network error) we need return empty slot to queue
  • Loading branch information...
1 parent c99bf86 commit 333043fbef14fe50a82beb972a03cbcb9c73e678 Doggy committed Oct 9, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 memcachepool/pool.py
View
@@ -46,7 +46,13 @@ def _checkout_connection(self):
now = int(time.time())
# If we got an empty slot placeholder, create a new connection.
if client is None:
- return now, self.factory()
+ try:
+ return now, self.factory()
+ except Exception,e:
+ if self.maxsize is not None:
+ #return slot to queue
+ self.clients.put(EMPTY_SLOT)
+ raise e
# If the connection is not stale, go ahead and use it.
if ts + self.timeout > now:
return ts, client

0 comments on commit 333043f

Please sign in to comment.