Skip to content

Commit

Permalink
Trying to prevent corner case where if the connection for only god kn…
Browse files Browse the repository at this point in the history
…ows reason crashes, the library is unable to restore the connection, preventing EVERY new query to work as intended
  • Loading branch information
0ssigeno committed Aug 29, 2024
1 parent 1132afa commit 40d24c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions djongo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ def create_cursor(self, name=None):
"""
Returns an active connection cursor to the database.
"""
if not self.connection:
self.connection = self.get_new_connection(self.get_connection_params())
return Cursor(self.client_connection, self.connection, self.djongo_connection)

def close_if_unusable_or_obsolete(self):
Expand Down

0 comments on commit 40d24c7

Please sign in to comment.