An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 7c50baf8 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

gitlab: do not persist the Client object

It seems that the connection pool is keeping sockets open for a long
time and after a quiet period, any connection sent is immediately
responded with with a TCP reset packet causing the connection to fail.
parent b9c20ea2
......@@ -28,7 +28,6 @@ use std::fmt::{self, Debug};
///
/// Separate users should use separate instances of this.
pub struct Gitlab {
client: Client,
base_url: Url,
token: String,
}
......@@ -94,7 +93,6 @@ impl Gitlab {
let base_url = try!(Url::parse(&format!("{}://{}/api/v3/", protocol, host)));
let api = Gitlab {
client: try!(Client::new()),
base_url: base_url,
token: token,
};
......@@ -462,7 +460,7 @@ impl Gitlab {
V: AsRef<str>,
{
let full_url = try!(self._mk_url_with_param(url, param));
let req = self.client.get(full_url);
let req = try!(Client::new()).get(full_url);
self._comm(req)
}
......@@ -476,7 +474,7 @@ impl Gitlab {
U: Serialize,
{
let full_url = try!(self._mk_url(url));
let req = self.client.post(full_url).form(&param);
let req = try!(Client::new()).post(full_url).form(&param);
self._comm(req)
}
......@@ -506,7 +504,7 @@ impl Gitlab {
let mut page_url = full_url.clone();
page_url.query_pairs_mut()
.extend_pairs(&[("page", page_str), ("per_page", per_page_str)]);
let req = self.client.get(page_url);
let req = try!(Client::new()).get(page_url);
let page: Vec<T> = try!(self._comm(req));
let page_len = page.len();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment