tenant_command: don't close sql sessions after each tenant (#65388)
This commit is contained in:
parent
8da569728c
commit
71fd12f260
|
@ -63,13 +63,6 @@ def run_command_from_argv(command, argv):
|
|||
'%s: %s: %s' % (connection.get_tenant(), e.__class__.__name__, exception_to_text(e))
|
||||
)
|
||||
return e
|
||||
finally:
|
||||
try:
|
||||
connections.close_all()
|
||||
except ImproperlyConfigured:
|
||||
# Ignore if connections aren't setup at this point (e.g. no
|
||||
# configured settings).
|
||||
pass
|
||||
|
||||
|
||||
class Command(InteractiveTenantOption, BaseCommand):
|
||||
|
@ -152,6 +145,12 @@ class Command(InteractiveTenantOption, BaseCommand):
|
|||
error = run_command_from_argv(klass, args)
|
||||
if error:
|
||||
errors.append(error)
|
||||
try:
|
||||
connections.close_all()
|
||||
except ImproperlyConfigured:
|
||||
# Ignore if connections aren't setup at this point (e.g. no
|
||||
# configured settings).
|
||||
pass
|
||||
if errors:
|
||||
self.stderr.write('Command failed on multiple tenants')
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in New Issue