Skip to content

Commit

Permalink
Fix IntegrityError during webserver startup (#27297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed Oct 27, 2022
1 parent 9ab1a6a commit 8f99c79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions airflow/cli/commands/webserver_command.py
Expand Up @@ -414,6 +414,12 @@ def webserver(args):

run_args += ["airflow.www.app:cached_app()"]

# To prevent different workers creating the web app and
# all writing to the database at the same time, we use the --preload option.
# With the preload option, the app is loaded before the workers are forked, and each worker will
# then have a copy of the app
run_args += ['--preload']

gunicorn_master_proc = None

def kill_proc(signum, _):
Expand Down
1 change: 1 addition & 0 deletions tests/cli/commands/test_webserver_command.py
Expand Up @@ -405,6 +405,7 @@ def test_cli_webserver_args(self):
"--access-logformat",
"custom_log_format",
"airflow.www.app:cached_app()",
"--preload",
],
close_fds=True,
)

0 comments on commit 8f99c79

Please sign in to comment.