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

Multiple services over multiple sockets example creates an incorrect AppConfig #3180

Open
pjenvey opened this issue Oct 30, 2023 · 0 comments

Comments

@pjenvey
Copy link
Contributor

pjenvey commented Oct 30, 2023

Per conversations on the discord, the most idiomatic way to spawn multiple services over multiple sockets is by following the current actix-http example using actix_server::Server.

This is preferred over the alternative of spawning more than one HttpServer as that results in each HttpServer spawning exclusive threads for themselves (e.g. 2 of them would spawn n*2 threads, where n is number of physical cores).

Expected Behavior

Current Behavior

However the example requires construction of an AppConfig whose only public constructor is its Default, which results in an incorrect configuration (server's hostname, address, and whether TLS is in use). This results in incorrect values for HttRequest's app_config, connection_info and maybe url_for methods and even possibly other things?

Possible Solution

Per @robjtede it's probable that this is a gap in the public interface. Either AppConfig needs an alternative constructor or possibly actix_server::Server or its builder could construct AppConfig from the values they have.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Actix Web Version: 4.2
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

No branches or pull requests

1 participant