From 9e5c19eba5e8894660b95ef232fd57842ab29238 Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Sun, 2 Apr 2023 13:38:28 +0300 Subject: [PATCH] Adjust remote signer idle connection timeout defaults. (#4779) * Adjust remote signer idle connection timeout defaults. * Address review comments. --- beacon_chain/validators/validator_pool.nim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/beacon_chain/validators/validator_pool.nim b/beacon_chain/validators/validator_pool.nim index c2a226bb6..a3f12515e 100644 --- a/beacon_chain/validators/validator_pool.nim +++ b/beacon_chain/validators/validator_pool.nim @@ -27,6 +27,12 @@ export const 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, "Number of validators attached to the beacon node" @@ -174,7 +180,11 @@ proc addRemoteValidator(pool: var ValidatorPool, block: var res: seq[(RestClientRef, RemoteSignerInfo)] 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(): # TODO keep trying in case of temporary network failure warn "Unable to resolve distributed signer address",