Default to Uvicorn workers=1, refs #999

This commit is contained in:
Simon Willison 2020-10-08 16:16:55 -07:00
commit 86823ae6f7
3 changed files with 4 additions and 14 deletions

View file

@ -465,7 +465,9 @@ def serve(
url = "http://{}:{}/".format(host, port)
if open_browser:
webbrowser.open(url)
uvicorn.run(ds.app(), host=host, port=port, log_level="info", lifespan="on")
uvicorn.run(
ds.app(), host=host, port=port, log_level="info", lifespan="on", workers=1
)
async def check_databases(ds):

View file

@ -73,10 +73,7 @@ def publish_subcommand(publish):
"about_url": about_url,
}
environment_variables = {
# Avoid uvicorn error: https://github.com/simonw/datasette/issues/633
"WEB_CONCURRENCY": "1"
}
environment_variables = {}
if plugin_secret:
extra_metadata["plugins"] = {}
for plugin_name, plugin_setting, setting_value in plugin_secret:

View file

@ -59,15 +59,6 @@ def test_publish_heroku(mock_call, mock_check_output, mock_which):
assert 0 == result.exit_code, result.output
mock_call.assert_has_calls(
[
mock.call(
[
"heroku",
"config:set",
"-a",
"f",
"WEB_CONCURRENCY=1",
]
),
mock.call(
["heroku", "builds:create", "-a", "f", "--include-vcs-ignore"]
),