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

Server: change use of Axum Extension with State #726

Closed
tasn opened this issue Dec 16, 2022 · 1 comment · Fixed by #761
Closed

Server: change use of Axum Extension with State #726

tasn opened this issue Dec 16, 2022 · 1 comment · Fixed by #761
Assignees
Labels
server Issues regarding the server component

Comments

@tasn
Copy link
Member

tasn commented Dec 16, 2022

We probably want to just pass this state to the worker too, and have a global state of connection pools, etc.

@tasn tasn added the server Issues regarding the server component label Dec 16, 2022
@swarna1101
Copy link

The purpose of this change is not clear from the information provided. However, it seems that the intention is to pass this state object to a worker and use it to manage connection pools and other resources.

To implement this change, you will need to modify the server code to pass the state object to the worker and use it to manage resources instead of the Axum Extension. You will also need to ensure that the worker has access to the state object and knows how to use it to manage resources.

It's worth noting that this is just one possible approach to the problem, and there may be other solutions that would be more appropriate depending on the specific needs of the project. It's always a good idea to carefully consider the implications of any code changes before implementing them.

@svix-andor svix-andor self-assigned this Jan 10, 2023
svix-gabriel added a commit that referenced this issue Jan 10, 2023
## Motivation
`State` is the new, type-safe way of passing around global state between
handlers in axum. `Extension`s were only resolved at runtime, therefore
if you forgot to pass an extension with `layer()` it'd only fail at
runtime. With `State` a handler can't be registered on the router if its
state can't pass all the required parameters to the handler.

## Solution
Replace all usage of `Extension` with state.

Closes #726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Issues regarding the server component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants