On Dec 6, 2013, at 6:27 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:

> 
> On Dec 6, 2013, at 6:01 PM, Claudio Freire <klaussfre...@gmail.com> wrote:
> 
>> On Fri, Dec 6, 2013 at 3:50 PM, Michael Bayer <mike...@zzzcomputing.com> 
>> wrote:
>>> +            except:
>>> +                self._overflow -= 1
>>> +                raise
>> 
>> 
>> That also needs to aquire the lock.
> 
> I think I’m going to make a different object out of “overflow” just to make 
> this easier to follow.  It just needs to be an atomic counter that goes 
> between M and N and tells you “yes” or “no”.   the code right now is very 
> inlined as it originates from a certain performance-crazy time in SQLA’s 
> history, but connection pool checkouts aren’t really per-statement these days.

OK more or less that, please review my commit at 
https://github.com/zzzeek/sqlalchemy/commit/d1cc78479d988bd9acbcf395483d2130b0873b1c
 which moves handling of “overflow” into _inc_overflow() and _dec_overflow() 
methods - the handling of the _overflow_lock is local to those methods.  The 
_do_get() method is a lot easier to read now.   Also added the existing test 
plus a new one to check the “decrement overflow on connection failed”.

thanks all for the help on this one.


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to