mirror of
https://github.com/odoo/runbot.git
synced 2025-03-16 07:55:45 +07:00
[FIX] runbot: terminate all active queries before dropping database
The docker using this database may still be alive.
This commit is contained in:
parent
41cdc7e5f9
commit
5697f1ab9c
@ -612,6 +612,9 @@ class runbot_build(models.Model):
|
||||
|
||||
def _local_pg_dropdb(self, dbname):
|
||||
with local_pgadmin_cursor() as local_cr:
|
||||
pid_col = 'pid' if local_cr._cnx.server_version >= 90200 else 'procpid'
|
||||
query = 'SELECT pg_terminate_backend({}) FROM pg_stat_activity WHERE datname=%s'.format(pid_col)
|
||||
local_cr.execute(query, [dbname])
|
||||
local_cr.execute('DROP DATABASE IF EXISTS "%s"' % dbname)
|
||||
# cleanup filestore
|
||||
datadir = appdirs.user_data_dir()
|
||||
|
Loading…
Reference in New Issue
Block a user