Skip to content

Commit

Permalink
feat(server): Apply HTTP timeout to all requests (#588)
Browse files Browse the repository at this point in the history
The `http.timeout` config variable was only applied to upstream queries,
but not to store requests. With this change, it is applied to all
requests as stated in the documentation. The timeout starts after
waiting for a connection and connecting.
  • Loading branch information
jan-auer authored May 26, 2020
1 parent 8a22667 commit ae5f4df
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions relay-server/src/actors/upstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,16 @@ impl UpstreamRelay {
// timeout to prevent the queued events from timing out while waiting for a free
// connection in the pool.
//
// This is dirty and not good enough in the long run. Right now filling up the "request
// queue" means that requests unrelated to `store` (queries, proxied/forwarded
// requests) are blocked by store requests. Ideally those requests would bypass this
// queue.
// This may not be good enough in the long run. Right now, filling up the "request
// queue" means that requests unrelated to `store` (queries, proxied/forwarded requests)
// are blocked by store requests. Ideally, those requests would bypass this queue.
//
// Two options come to mind:
//
// 1.) Have own connection pool for `store` requests
//
// 2.) Buffer up/queue/synchronize events before creating the request
//
// 1. Have own connection pool for `store` requests
// 2. Buffer up/queue/synchronize events before creating the request
.wait_timeout(self.config.event_buffer_expiry())
// This is the timeout after wait + connect.
.timeout(self.config.http_timeout())
.map_err(UpstreamRequestError::SendFailed)
.and_then(|response| match response.status() {
StatusCode::TOO_MANY_REQUESTS => {
Expand Down Expand Up @@ -244,7 +242,6 @@ impl UpstreamRelay {
let future = self
.send_request(method, path, |builder| {
builder
.timeout(self.config.http_timeout())
.header("X-Sentry-Relay-Signature", signature)
.header(header::CONTENT_TYPE, "application/json")
.body(json)
Expand Down

0 comments on commit ae5f4df

Please sign in to comment.