Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django_replicated/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def process_response(self, request, response):
routers.reset()
return response

def process_exception(self, request, exception):
if settings.REPLICATED_RESET_ON_EXCEPTION:
routers.reset()

def check_state_override(self, request, state):
'''
Used to check if a web request should use a master or slave
Expand Down
3 changes: 3 additions & 0 deletions django_replicated/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@
# Status codes on which set cookie for read-after-write workaround
REPLICATED_FORCE_MASTER_COOKIE_STATUS_CODES = (302, 303)

# Reset state on exception in request
REPLICATED_RESET_ON_EXCEPTION = False


REPLICATED_MANAGE_ATOMIC_REQUESTS = False