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

Refactor: custom fastn_core::http::Response for fastn_core::serve #2035

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

siddhantk232
Copy link
Contributor

actix_web::HttpResponse aka fastn_core::http::Response is not Send which makes it impossible to share it across threads. A direct downside of this is that we can't use a function which uses this type in a tokio::spawn because it required types to implement Send.

A custom fastn_core::http::Response is added which is Send and used by the fastn_core::serve function. A fastn_core::serve_actix is also introduced which is a direct replacement for the old fastn_core::serve.

This will allow us to, for example, use fastn_core::serve in a background task to update the cache.

`actix_web::HttpResponse` aka `fastn_core::http::Response` is not `Send`
which makes it impossible to share it across threads. A direct downside
of this is that we can't use a function which uses this type in a
`tokio::spawn` because it required types to implement `Send`.

A custom `fastn_core::http::Response` is added which is `Send` and used
by the `fastn_core::serve` function. A `fastn_core::serve_actix` is also
introduced which is a direct replacement for the old
`fastn_core::serve`.

This will allow us to, for example, use `fastn_core::serve` in a
background task to update the cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant