Adjust remote signer idle connection timeout defaults. (#4779)

* Adjust remote signer idle connection timeout defaults.

* Address review comments.
This commit is contained in:
Eugene Kabanov 2023-04-02 13:38:28 +03:00 committed by GitHub
parent c31fbc3977
commit 9e5c19eba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,12 @@ export
const const
WEB3_SIGNER_DELAY_TOLERANCE = 3.seconds WEB3_SIGNER_DELAY_TOLERANCE = 3.seconds
WEB3_SIGNER_DEFAULT_TIMEOUT = (int64(SECONDS_PER_SLOT) + 1).seconds
# This timeout value should not be greater than default value specified at:
# https://docs.web3signer.consensys.net/Reference/CLI/CLI-Syntax#idle-connection-timeout-seconds
WEB3_SIGNER_CHECKING_PERIOD = ((int64(SECONDS_PER_SLOT) + 1) div 3).seconds
# Host often connection pool will collect/destroy connections which are
# expired.
declareGauge validators, declareGauge validators,
"Number of validators attached to the beacon node" "Number of validators attached to the beacon node"
@ -174,7 +180,11 @@ proc addRemoteValidator(pool: var ValidatorPool,
block: block:
var res: seq[(RestClientRef, RemoteSignerInfo)] var res: seq[(RestClientRef, RemoteSignerInfo)]
for remote in keystore.remotes: for remote in keystore.remotes:
let client = RestClientRef.new($remote.url, prestoFlags, httpFlags) let client = RestClientRef.new(
$remote.url, prestoFlags, httpFlags,
idleTimeout = WEB3_SIGNER_DEFAULT_TIMEOUT,
idlePeriod = WEB3_SIGNER_CHECKING_PERIOD,
)
if client.isErr(): if client.isErr():
# TODO keep trying in case of temporary network failure # TODO keep trying in case of temporary network failure
warn "Unable to resolve distributed signer address", warn "Unable to resolve distributed signer address",