Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions server/src/actors/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@ pub struct Server {
impl Server {
pub fn start(config: Config) -> Result<Addr<Self>, ServerError> {
metric!(counter("server.starting") += 1);
// spawn our own services into the default arbiter
let service_state = ServiceState::start(config)?;

// spawn the HTTP server into a separate arbiter to make connects faster
Ok(Arbiter::start(|_ctx| {
let http_server = service::start(service_state).unwrap();
Server { http_server }
}))
let http_server = service::start(ServiceState::start(config)?)?;
Ok(Server { http_server }.start())
}
}

Expand Down
12 changes: 6 additions & 6 deletions server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ impl ServiceState {
.context(ServerErrorKind::ConfigError)?
.start();

let connector = ClientConnector::default()
.limit(config.max_concurrent_requests())
.start();

System::current().registry().set(connector);

Ok(ServiceState {
config: config.clone(),
upstream_relay: upstream_relay.clone(),
Expand Down Expand Up @@ -299,6 +293,12 @@ pub fn start(state: ServiceState) -> Result<Recipient<server::StopServer>, Serve
.backlog(config.max_pending_connections())
.disable_signals();

let connector = ClientConnector::default()
.limit(config.max_concurrent_requests())
.start();

System::current().registry().set(connector);

server = listen(server, &config)?;
server = listen_ssl(server, &config)?;

Expand Down