forked from cs3org/reva
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow configuring grpc max connection age
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Enhancement: Allow configuring grpc max connection age | ||
|
||
We added a GRPC_MAX_CONNECTION_AGE env var that allows limiting the lifespan of connections. A closed connection triggers grpc clients to do a new DNS lookup to pick up new IPs. | ||
|
||
https://github.com/cs3org/reva/pull/4772 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package rgrpc | ||
|
||
import ( | ||
"math" | ||
"os" | ||
"time" | ||
) | ||
|
||
const ( | ||
_serverMaxConnectionAgeEnv = "GRPC_MAX_CONNECTION_AGE" | ||
|
||
// same default as grpc | ||
infinity = time.Duration(math.MaxInt64) | ||
_defaultMaxConnectionAge = infinity | ||
) | ||
|
||
// GetMaxConnectionAge returns the maximum grpc connection age. | ||
func GetMaxConnectionAge() time.Duration { | ||
d, err := time.ParseDuration(os.Getenv(_serverMaxConnectionAgeEnv)) | ||
if err != nil { | ||
return _defaultMaxConnectionAge | ||
} | ||
return d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters