From 86823ae6f7b7401455e8bff254e58715cf5d726c Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 8 Oct 2020 16:16:55 -0700 Subject: [PATCH] Default to Uvicorn workers=1, refs #999 --- datasette/cli.py | 4 +++- datasette/publish/heroku.py | 5 +---- tests/test_publish_heroku.py | 9 --------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/datasette/cli.py b/datasette/cli.py index 28edd590..ca02afad 100644 --- a/datasette/cli.py +++ b/datasette/cli.py @@ -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): diff --git a/datasette/publish/heroku.py b/datasette/publish/heroku.py index 24393b90..0f8564c3 100644 --- a/datasette/publish/heroku.py +++ b/datasette/publish/heroku.py @@ -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: diff --git a/tests/test_publish_heroku.py b/tests/test_publish_heroku.py index ac2744c1..e0035a83 100644 --- a/tests/test_publish_heroku.py +++ b/tests/test_publish_heroku.py @@ -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"] ),