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))
|
'%s: %s: %s' % (connection.get_tenant(), e.__class__.__name__, exception_to_text(e))
|
||||||
)
|
)
|
||||||
return 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):
|
class Command(InteractiveTenantOption, BaseCommand):
|
||||||
|
@ -152,6 +145,12 @@ class Command(InteractiveTenantOption, BaseCommand):
|
||||||
error = run_command_from_argv(klass, args)
|
error = run_command_from_argv(klass, args)
|
||||||
if error:
|
if error:
|
||||||
errors.append(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:
|
if errors:
|
||||||
self.stderr.write('Command failed on multiple tenants')
|
self.stderr.write('Command failed on multiple tenants')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue