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

fix too much unclosed sockets (file descriptor) #1413

Merged
merged 7 commits into from
Oct 8, 2019
8 changes: 6 additions & 2 deletions chain/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::time::Duration;

use actix::prelude::Future;
use actix::{Actor, Addr, Context, Handler, Message};
use actix_web::client::Client;
use actix_web::client::{Client, Connector};
use serde_derive::{Deserialize, Serialize};

/// Timeout for establishing connection.
Expand Down Expand Up @@ -32,7 +32,11 @@ impl Default for TelemetryActor {

impl TelemetryActor {
pub fn new(config: TelemetryConfig) -> Self {
let client = Client::build().timeout(CONNECT_TIMEOUT).finish();
let client = Client::build().timeout(CONNECT_TIMEOUT).connector(
Connector::new()
.conn_lifetime(Duration::from_secs(u64::max_value()))
.conn_keep_alive(Duration::from_secs(30))
.finish()).finish();
Self { config, client }
}
}
Expand Down