mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Fixed #15119 -- Stopped pinging the MySQL server.
This commit is contained in:
parent
aea98e8c53
commit
282b2f40cd
@ -53,11 +53,8 @@ class BaseDatabaseWrapper(object):
|
|||||||
|
|
||||||
__hash__ = object.__hash__
|
__hash__ = object.__hash__
|
||||||
|
|
||||||
def _valid_connection(self):
|
|
||||||
return self.connection is not None
|
|
||||||
|
|
||||||
def _cursor(self):
|
def _cursor(self):
|
||||||
if not self._valid_connection():
|
if self.connection is None:
|
||||||
conn_params = self.get_connection_params()
|
conn_params = self.get_connection_params()
|
||||||
self.connection = self.get_new_connection(conn_params)
|
self.connection = self.get_new_connection(conn_params)
|
||||||
self.init_connection_state()
|
self.init_connection_state()
|
||||||
|
@ -402,15 +402,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|||||||
self.introspection = DatabaseIntrospection(self)
|
self.introspection = DatabaseIntrospection(self)
|
||||||
self.validation = DatabaseValidation(self)
|
self.validation = DatabaseValidation(self)
|
||||||
|
|
||||||
def _valid_connection(self):
|
|
||||||
if self.connection is not None:
|
|
||||||
try:
|
|
||||||
self.connection.ping()
|
|
||||||
return True
|
|
||||||
except DatabaseError:
|
|
||||||
self.close()
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get_connection_params(self):
|
def get_connection_params(self):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'conv': django_conversions,
|
'conv': django_conversions,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user