Skip to content

Commit

Permalink
Fixed #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Kaledin committed Apr 14, 2018
1 parent 0f9224d commit 567aeed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions django_apscheduler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def __ping(self):

def __reconnect(self):
LOGGER.warning("Mysql closed the connection. Perform reconnect...")
connection.connection.close()
connection.connection = None

if connection.connection:
connection.connection.close()
connection.connection = None
else:
LOGGER.warning("Connection was already closed.")


class DjangoJob(models.Model):
Expand Down

0 comments on commit 567aeed

Please sign in to comment.