[PATCH 4 of 9 cubicweb] [server] use a LifoQueue in _CnxSetPool

Philippe Pepiot ph at itsalwaysdns.eu
Wed Apr 1 09:03:11 CEST 2020


On 31/03/2020, Philippe Pepiot wrote:
> On 31/03/2020, Philippe Pepiot wrote:
> > # HG changeset patch
> > # User Philippe Pepiot <ph at itsalwaysdns.eu>
> > # Date 1585575002 -7200
> > #      Mon Mar 30 15:30:02 2020 +0200
> > # Node ID f08a3c909bfaaef5c07376ffc23d35987a33b5c3
> > # Parent  0dca6687fcf5fd2754da447856360c365d8d15c2
> > # Available At https://philpep.org/pub/hg/cubicweb
> > #              hg pull https://philpep.org/pub/hg/cubicweb -r f08a3c909bfa
> > [server] use a LifoQueue in _CnxSetPool
> > 
> > In postgresql, some cache is attached to the connection. Using a LifoQueue
> > (last-in, first-out) makes a few connections to get the most load which give
> > best performance.
> > 
> > diff --git a/cubicweb/server/repository.py b/cubicweb/server/repository.py
> > --- a/cubicweb/server/repository.py
> > +++ b/cubicweb/server/repository.py
> > @@ -173,7 +173,7 @@ class _CnxSetPool(_BaseCnxSet):
> >      def __init__(self, source, size):
> >          super().__init__(source)
> >          self._cnxsets = []
> > -        self._queue = queue.Queue()
> > +        self._queue = queue.LifoQueue()
> 
> There is a side effect error with this patch when running "cubicweb-ctl
> db-create" on postgresql:
> 
> psycopg2.InterfaceError: cursor already closed

I found it! Patch sent and rebased this series on top of it.
Also fixed a broken test_config_value_from_environment_int in last patch
New head is 6cd938c "hg pull https://philpep.org/pub/hg/cubicweb -r 6cd938c"

PS: A lot of tests (misc & web) are currently broken by a17cbf53

Have a good day!

-- 
https://itsalwaysdns.eu



More information about the cubicweb-devel mailing list