-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better connection handling, prepare for the release
- Loading branch information
Showing
3 changed files
with
17 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,6 @@ | ||
from django_cassandra_engine.utils import get_cassandra_connection | ||
|
||
cassandra_connection = get_cassandra_connection() | ||
|
||
|
||
try: | ||
from uwsgidecorators import postfork | ||
except ImportError: | ||
# We're not in a uWSGI context, no need to hook Cassandra session | ||
# initialization to the postfork event. | ||
if cassandra_connection is not None: | ||
cassandra_connection.connect() | ||
else: | ||
@postfork | ||
def cassandra_init(): | ||
""" Initialize a new Cassandra session in the context. | ||
Ensures that a new session is returned for every new request. | ||
""" | ||
if cassandra_connection is not None: | ||
cassandra_connection.reconnect() | ||
cassandra_connection = get_cassandra_connection() | ||
if cassandra_connection is not None: | ||
cassandra_connection.connect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters