Start of HA middleware.

This commit is contained in:
Luke Sneeringer
2014-10-01 16:36:34 -05:00
parent 57194c9a89
commit 0e623f2337
3 changed files with 16 additions and 0 deletions

View File

@@ -61,3 +61,14 @@ class ActivityStreamMiddleware(threading.local):
else:
if instance.id not in self.instance_ids:
self.instance_ids.append(instance.id)
class HAMiddlware(object):
"""A middleware class that checks to see whether the request is being
served on a secondary instance, and redirects the request back to the
primary instance if so.
"""
def process_request(self, request):
"""Process the request, and redirect if this is a request on a
secondary node.
"""