Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
comms
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xx network
comms
Commits
5eaad8f8
Commit
5eaad8f8
authored
Jun 17, 2021
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
adjusted client keepalive options, allowing them to be configured
parent
191473de
No related branches found
No related tags found
1 merge request
!11
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
connect/host.go
+1
-18
1 addition, 18 deletions
connect/host.go
connect/hostParams.go
+12
-0
12 additions, 0 deletions
connect/hostParams.go
with
13 additions
and
18 deletions
connect/host.go
+
1
−
18
View file @
5eaad8f8
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"math"
"math"
"net"
"net"
"strings"
"strings"
...
@@ -32,22 +31,6 @@ import (
...
@@ -32,22 +31,6 @@ import (
"time"
"time"
)
)
const
infinityTime
=
time
.
Duration
(
math
.
MaxInt64
)
//4 MB
const
MaxWindowSize
=
math
.
MaxInt32
// KaClientOpts are the keepalive options for clients
// TODO: Set via configuration
var
KaClientOpts
=
keepalive
.
ClientParameters
{
// Never ping to keepalive
Time
:
infinityTime
,
// 60s after ping before closing
Timeout
:
60
*
time
.
Second
,
// For all connections, with and without streaming
PermitWithoutStream
:
true
,
}
// Information used to describe a connection to a host
// Information used to describe a connection to a host
type
Host
struct
{
type
Host
struct
{
// System-wide ID of the Host
// System-wide ID of the Host
...
@@ -396,7 +379,7 @@ func (h *Host) connectHelper() (err error) {
...
@@ -396,7 +379,7 @@ func (h *Host) connectHelper() (err error) {
dialOpts
:=
[]
grpc
.
DialOption
{
dialOpts
:=
[]
grpc
.
DialOption
{
grpc
.
WithBlock
(),
grpc
.
WithBlock
(),
grpc
.
WithKeepaliveParams
(
KaClientOpts
),
grpc
.
WithKeepaliveParams
(
h
.
params
.
KaClientOpts
),
securityDial
,
securityDial
,
}
}
...
...
This diff is collapsed.
Click to expand it.
connect/hostParams.go
+
12
−
0
View file @
5eaad8f8
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
package
connect
package
connect
import
(
import
(
"google.golang.org/grpc/keepalive"
"time"
"time"
)
)
...
@@ -34,6 +35,9 @@ type HostParams struct {
...
@@ -34,6 +35,9 @@ type HostParams struct {
// List of sending errors that are deemed unimportant
// List of sending errors that are deemed unimportant
// Reception of these errors will not update the Metric state
// Reception of these errors will not update the Metric state
ExcludeMetricErrors
[]
string
ExcludeMetricErrors
[]
string
// KeepAlive Options for Host connections
KaClientOpts
keepalive
.
ClientParameters
}
}
// GetDefaultHostParams Get default set of host params
// GetDefaultHostParams Get default set of host params
...
@@ -47,5 +51,13 @@ func GetDefaultHostParams() HostParams {
...
@@ -47,5 +51,13 @@ func GetDefaultHostParams() HostParams {
SendTimeout
:
2
*
time
.
Minute
,
SendTimeout
:
2
*
time
.
Minute
,
EnableMetrics
:
false
,
EnableMetrics
:
false
,
ExcludeMetricErrors
:
make
([]
string
,
0
),
ExcludeMetricErrors
:
make
([]
string
,
0
),
KaClientOpts
:
keepalive
.
ClientParameters
{
// Send keepAlive every Time interval
Time
:
5
*
time
.
Second
,
// Timeout after last successful keepAlive to close connection
Timeout
:
60
*
time
.
Second
,
// For all connections, with and without streaming
PermitWithoutStream
:
true
,
},
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment