Add stop Pool and use it when dropping database
This commit is contained in:
1 parent
54c79dddc5
commit
1be5fa9499
2 files changed
+16
No files matched your search
@@ -76,6 +76,21 @@ class Pool(object):
|
||||
finally:
|
||||
Pool._lock.release()
|
||||
|
||||
@staticmethod
|
||||
def stop(database_name):
|
||||
'''
|
||||
Stop the Pool
|
||||
'''
|
||||
Pool._lock.acquire()
|
||||
lock = Pool._locks.setdefault(database_name, RLock())
|
||||
Pool._lock.release()
|
||||
lock.acquire()
|
||||
if database_name in Pool._pool:
|
||||
del Pool._pool[database_name]
|
||||
if database_name in Pool._pools:
|
||||
del Pool._pools[database_name]
|
||||
lock.release()
|
||||
|
||||
@staticmethod
|
||||
def database_list():
|
||||
'''
|
||||
|
||||
@@ -239,6 +239,7 @@ def drop(database_name, password):
|
||||
raise
|
||||
else:
|
||||
logger.info('DROP DB: %s' % (database_name))
|
||||
Pool.stop(database_name)
|
||||
finally:
|
||||
cursor.close(close=True)
|
||||
return True
|
||||
|
||||
Reference in new issue
Block a user