-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Shane Hathaway wrote: > On 06/25/2010 12:03 PM, Wichert Akkerman wrote: >> I am using repoze.zodbconn in a BFG application but I suspect it is not >> working as it should be: as soon as multiple requests come in at the >> same time I get a lot of locking errors and broken results: >> >> LockError: Couldn't lock >> '/Users/wichert/Work/code/buildout/blackbox/var/Data.fs.lock' >> >> The way I've setup repoze.zodbconn is >> >> from repoze.zodbconn.finder import PersistentApplicationFinder >> from myproject import appmaker >> finder = PersistentApplicationFinder(settings["zodb.url"], appmaker) >> def get_root(request): >> return finder(request.environ) >> return get_root > > According to the docs[1], your code should look more like this: > > from repoze.zodbconn.finder import PersistentApplicationFinder > from myproject import appmaker > finder = PersistentApplicationFinder(settings["zodb.url"], > appmaker) > app = finder(request.environ) > return app > > OTOH, personally, I don't think this is a good pattern. I think the > right idea is to open the connection in the WSGI stack [2]. That way, > other WSGI components can use the connection, and you can guarantee that > the connection gets closed. repoze.zodbconn supports both patterns.
Could we make your preferred pattern lazier? E.g., instead of opening the connection and stashing it in the environ, could we stash an "opener" function, which would then be called by the API used by the app to extract the connection from the environ. That function could arrange to have the "closer" written back into the environ for the egress-side zodbconn middleware to use, for instance. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkwlB0sACgkQ+gerLs4ltQ5MFACgmZtNQP1nhXR/Cwcg+WjR8qb5 sbIAoLODPOVTmXJDpoRPKmqxvFk/F+7k =nD9V -----END PGP SIGNATURE----- _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev