upgrade: Skip the pre-work if the server is already stopped.

This optimization makes sense if the server is already running, but if
it is already stopped, it is just prolonging the downtime.
This commit is contained in:
Alex Vandiver 2022-03-25 16:16:58 -07:00 committed by Tim Abbott
parent 05af4b0a11
commit b15d8e0118
1 changed files with 5 additions and 2 deletions

View File

@ -322,9 +322,12 @@ else:
# Our next optimization is to check whether any migrations are needed # Our next optimization is to check whether any migrations are needed
# before we start the critical section of the restart. This saves # before we start the critical section of the restart. This saves
# about 1s of downtime in a no-op upgrade. # about 1s of downtime in a no-op upgrade. We omit this check if we
# already stopped the server above, due to low memory.
migrations_needed = False migrations_needed = False
if not args.skip_migrations: if not IS_SERVER_UP:
migrations_needed = True
elif not args.skip_migrations:
logging.info("Checking for needed migrations") logging.info("Checking for needed migrations")
migrations_output = subprocess.check_output( migrations_output = subprocess.check_output(
["./manage.py", "showmigrations"], preexec_fn=su_to_zulip, text=True ["./manage.py", "showmigrations"], preexec_fn=su_to_zulip, text=True