# HG changeset patch # User Denis Laxalde # Date 1489143761 -3600 # Node ID 1a1d2f5faddb41c03da9782d9c605e593ee7303d # Parent bff3be6eebeddcc4e17b6f7c018a2df13de29280 [pyramid] Call repository's shutdown method atexit This way when run through a WSGI server (pserve, gunicorn, etc.) we make sure that the repository is properly shut down. In particular, this would wait for threads to terminate (otherwise, they'll be killed). diff -r bff3be6eebed -r 1a1d2f5faddb cubicweb/pyramid/__init__.py --- a/cubicweb/pyramid/__init__.py Fri Mar 03 11:13:03 2017 +0100 +++ b/cubicweb/pyramid/__init__.py Fri Mar 10 12:02:41 2017 +0100 @@ -20,8 +20,10 @@ """Pyramid interface to CubicWeb""" +import atexit import os from warnings import warn + import wsgicors from cubicweb.cwconfig import CubicWebConfiguration as cwcfg @@ -224,6 +226,8 @@ repo = config.registry['cubicweb.repository'] = cwconfig.repository() config.registry['cubicweb.registry'] = repo.vreg + atexit.register(repo.shutdown) + if asbool(config.registry.settings.get('cubicweb.defaults', True)): config.include('cubicweb.pyramid.defaults')