mirror of
https://github.com/simonw/datasette.git
synced 2026-09-02 22:54:08 +02:00
Tweaked some comments
This commit is contained in:
parent
c748683f2e
commit
fc6c5ab92f
2 changed files with 2 additions and 10 deletions
|
|
@ -670,11 +670,9 @@ def serve(
|
|||
raise click.ClickException("--token can only be used with --get")
|
||||
|
||||
if get:
|
||||
# Run async soundness checks before startup hooks, since invoke_startup
|
||||
# now populates internal tables which requires querying each database
|
||||
# --get means we don't run Uvicorn at all
|
||||
run_sync(lambda: check_databases(ds))
|
||||
|
||||
# Run the "startup" plugin hooks
|
||||
try:
|
||||
run_sync(ds.invoke_startup)
|
||||
except StartupError as e:
|
||||
|
|
@ -709,8 +707,7 @@ def serve(
|
|||
# on the loop (asyncio.create_task, Lock/Queue/Event objects, ...) is
|
||||
# still alive when the server starts handling requests.
|
||||
async def _serve_async():
|
||||
# Run async soundness checks before startup hooks, since invoke_startup
|
||||
# now populates internal tables which requires querying each database
|
||||
# Populate internal catalog tables before invoke_startup
|
||||
await check_databases(ds)
|
||||
|
||||
# Run the "startup" plugin hooks
|
||||
|
|
|
|||
|
|
@ -127,11 +127,6 @@ def test_startup_error_fails_fast_before_port_binds(serve_with_plugins):
|
|||
A "startup" plugin hook that raises StartupError must fail fast: print
|
||||
the message, exit non-zero, and never accept a connection on the port -
|
||||
the failure must happen before uvicorn.Server binds the socket.
|
||||
|
||||
Note this is a characterization test, not a regression test: it also
|
||||
passes on unmodified main, where startup already ran ahead of
|
||||
uvicorn.run(). It earns its keep once startup moves into the ASGI
|
||||
lifespan, where fail-fast is genuinely at risk.
|
||||
"""
|
||||
proc, port = serve_with_plugins(
|
||||
{"startup_error_plugin": STARTUP_ERROR_PLUGIN}, wait_for_startup=False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue