From c6de0204289efcc6f68de8e1f7c7f457a5ccfdb3 Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Thu, 4 Nov 2021 20:46:22 -0700 Subject: [PATCH] Add custom config for autoconnect peer interval (#1759) --- docs/CONFIGURATION.md | 1 + squeaknode/config/config.py | 3 +++ squeaknode/node/squeak_node.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 76a37bb6..ea933311 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -19,6 +19,7 @@ node.squeak_retention_s | int | [0,...] | yes | 604800 | SQUEAKNODE_NODE_SQUEAK_ node.squeak_deletion_interval_s | int | [0,...] | yes | 10 | SQUEAKNODE_NODE_SQUEAK_DELETION_INTERVAL_S | The amount of time in seconds to wait in between deleting old squeaks. node.offer_deletion_interval_s | int | [0,...] | yes | 10 | SQUEAKNODE_NODE_OFFER_DELETION_INTERVAL_S | The amount of time in seconds to wait in between deleting old offers. node.interest_block_interval | int | [0,...] | yes | 2016 | SQUEAKNODE_NODE_INTEREST_BLOCK_INTERVAL | The number of blocks (starting from the most recent and descending) that this node will attempt to find squeaks with matching block height. +node.peer_autoconnect_interval_s | int | [0,...] | yes | 10 | SQUEAKNODE_NODE_PEER_AUTOCONNECT_INTERVAL_S | The amount of time in seconds to wait in between trying to connect autoconnect peers. bitcoin.rpc_host | string | | yes | "localhost" | SQUEAKNODE_BITCOIN_RPC_HOST | The host of the bitcoin node to connect. bitcoin.rpc_port | int | | yes | 18334 | SQUEAKNODE_BITCOIN_RPC_HOST | The port of the bitcoin node to connect. bitcoin.rpc_user | string | | yes | "" | SQUEAKNODE_BITCOIN_RPC_USER | The username to use for authentication on the bitcoin node. diff --git a/squeaknode/config/config.py b/squeaknode/config/config.py index efa2f81d..d06c9a3e 100644 --- a/squeaknode/config/config.py +++ b/squeaknode/config/config.py @@ -62,6 +62,7 @@ DEFAULT_INTEREST_BLOCK_INTERVAL = 2016 DEFAULT_SENT_OFFER_RETENTION_S = 86400 DEFAULT_RECEIVED_OFFER_RETENTION_S = 86400 DEFAULT_OFFER_DELETION_INTERVAL_S = 10 +DEFAULT_PEER_AUTOCONNECT_INTERVAL_S = 10 DEFAULT_SUBSCRIBE_INVOICES_RETRY_S = 10 DEFAULT_SQUEAK_RETENTION_S = 604800 DEFAULT_SQUEAK_DELETION_INTERVAL_S = 10 @@ -151,6 +152,8 @@ class NodeConfig(Config): cast=int, required=False, default=DEFAULT_OFFER_DELETION_INTERVAL_S) interest_block_interval = key( cast=int, required=False, default=DEFAULT_INTEREST_BLOCK_INTERVAL) + peer_autoconnect_interval_s = key( + cast=int, required=False, default=DEFAULT_PEER_AUTOCONNECT_INTERVAL_S) @section('db') diff --git a/squeaknode/node/squeak_node.py b/squeaknode/node/squeak_node.py index 6c27a454..60e2a82f 100644 --- a/squeaknode/node/squeak_node.py +++ b/squeaknode/node/squeak_node.py @@ -229,7 +229,7 @@ class SqueakNode: def initialize_peer_connection_worker(self): self.peer_connection_worker = PeerConnectionWorker( self.squeak_controller, - 10, + self.config.node.peer_autoconnect_interval_s, ) def initialize_squeak_deletion_worker(self):