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

services/horizon: Ignore ConnectionTimeout in txsub #2818

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
1 change: 1 addition & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).x
- `core-db-max-open-connections`
- `core-db-max-idle-connections`
* HAL response population is implemented using Go `strings` package instead of `regexp`, improving its performance.
* The `--connection-timeout` param is ignored in `POST /transactions`. The requests sent to that endpoint will always timeout after 30 seconds.

## v1.5.0

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ var configOpts = support.ConfigOptions{
OptType: types.Int,
FlagDefault: 55,
CustomSetValue: support.SetDuration,
Usage: "defines the timeout of connection after which 504 response will be sent or stream will be closed, if Horizon is behind a load balancer with idle connection timeout, this should be set to a few seconds less that idle timeout",
Usage: "defines the timeout of connection after which 504 response will be sent or stream will be closed, if Horizon is behind a load balancer with idle connection timeout, this should be set to a few seconds less that idle timeout, does not apply to POST /transactions",
},
&support.ConfigOption{
Name: "per-hour-rate-limit",
Expand Down
5 changes: 4 additions & 1 deletion services/horizon/internal/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ func timeoutMiddleware(timeout time.Duration) func(next http.Handler) http.Handl
}
}()

r = r.WithContext(ctx)
// txsub has a custom timeout
if r.Method != http.MethodPost {
r = r.WithContext(ctx)
}
next.ServeHTTP(mw, r)
}
return http.HandlerFunc(fn)
Expand Down