Try to configure the 'pyramid_retry' package, if available
this is used (as of pyramid 1.9) for gracefully handling postgres restarts
This commit is contained in:
parent
3df1407073
commit
92c1b165fb
|
@ -96,7 +96,12 @@ def provide_postgresql_settings(settings):
|
|||
this enables retrying transactions a second time, in an attempt to
|
||||
gracefully handle database restarts.
|
||||
"""
|
||||
settings.setdefault('tm.attempts', 2)
|
||||
try:
|
||||
import pyramid_retry
|
||||
except ImportError:
|
||||
settings.setdefault('tm.attempts', 2)
|
||||
else:
|
||||
settings.setdefault('retry.attempts', 2)
|
||||
|
||||
|
||||
class Root(dict):
|
||||
|
@ -135,6 +140,15 @@ def make_pyramid_config(settings, configure_csrf=True):
|
|||
config.include('pyramid_mako')
|
||||
config.include('pyramid_tm')
|
||||
|
||||
# bring in the pyramid_retry logic, if available
|
||||
# TODO: pretty soon we can require this package, hopefully..
|
||||
try:
|
||||
import pyramid_retry
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
config.include('pyramid_retry')
|
||||
|
||||
# Add some permissions magic.
|
||||
config.add_directive('add_tailbone_permission_group', 'tailbone.auth.add_permission_group')
|
||||
config.add_directive('add_tailbone_permission', 'tailbone.auth.add_permission')
|
||||
|
|
Loading…
Reference in a new issue