Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup hook should block until URL is loaded #1

Closed
simonw opened this issue Jul 29, 2021 · 1 comment
Closed

Startup hook should block until URL is loaded #1

simonw opened this issue Jul 29, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Jul 29, 2021

We mostly have a 0.2 second limit on how long we wait for the URL to load.

We should make an exception on startup - because the initial metadata file may include configuration for authentication, which should be loaded before processing any requests.

@hookimpl
def startup(datasette):
async def inner():
await update_remote_with_time_limit(datasette, timelimit=0.2)
return inner

What should happen if the URL fails to load? Probably should prevent Datasette from starting up at all, but can that plugin hook cancel Datasette's startup by raising an exception?

The documentation suggests that an assert will prevent Datasette starting: https://docs.datasette.io/en/stable/plugin_hooks.html#startup-datasette

@simonw simonw added the enhancement New feature or request label Jul 29, 2021
@simonw
Copy link
Owner Author

simonw commented Jul 29, 2021

I'm going to have timelimit=None mean "wait no matter how long".

@simonw simonw closed this as completed in 24479bc Jul 29, 2021
simonw added a commit that referenced this issue Jul 29, 2021
simonw added a commit that referenced this issue Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant