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

In multiworker mode better error message if no apps #2579

Closed
ahopkins opened this issue Oct 20, 2022 · 2 comments · Fixed by #2585
Closed

In multiworker mode better error message if no apps #2579

ahopkins opened this issue Oct 20, 2022 · 2 comments · Fixed by #2585
Assignees

Comments

@ahopkins
Copy link
Member

If a developer does not define their app so that a worker process can access it, they will receive a KeyError when Sanic tries to access it from the registry.

For example, that would happen if an app only was instantiated on the main process:

if __name__ == "__main__":
    app = Sanic(...)
    app.run()

The solution to this is usually either to move the instantiation outside that block, or to use an AppLoader.

We should provide a better error message from within a worker process if an app cannot be found in a registry.

@scardozos
Copy link
Contributor

I want to take it🙂

@prryplatypus
Copy link
Member

All yours 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants