Skip to content

Commit

Permalink
fix too much unclosed sockets (file descriptor) (#1413)
Browse files Browse the repository at this point in the history
* fix too much unclosed sockets (file descriptor)
  • Loading branch information
ailisp committed Oct 8, 2019
1 parent 0b9079f commit ba08156
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit ba08156

Please sign in to comment.