Browse Source

HTTPClient: honor `--http-timeout`

The MMGen Project 6 months ago
parent
commit
5bc0977948
4 changed files with 4 additions and 4 deletions
  1. 1 1
      mmgen/cfg.py
  2. 1 1
      mmgen/http.py
  3. 1 1
      mmgen/opts.py
  4. 1 1
      mmgen/rpc/local.py

+ 1 - 1
mmgen/cfg.py

@@ -170,7 +170,7 @@ class Config(Lockable):
 	no_license      = False
 
 	# limits
-	http_timeout       = 60
+	http_timeout       = 0
 	usr_randchars      = 30
 	fee_adjust         = 1.0
 	fee_estimate_confs = 3

+ 1 - 1
mmgen/http.py

@@ -47,7 +47,7 @@ class HTTPClient:
 		url = self.network_proto + '://' + self.host + path
 		kwargs = {
 			'url': url,
-			'timeout': timeout or self.timeout,
+			'timeout': self.cfg.http_timeout or timeout or self.timeout,
 			'verify': self.verify}
 		if data:
 			kwargs['data'] = data

+ 1 - 1
mmgen/opts.py

@@ -301,7 +301,7 @@ class UserOpts(Opts):
 			Rr --daemon-id=ID         Specify the coin daemon ID
 			rr --ignore-daemon-version Ignore coin daemon version check
 			Rr --list-daemon-ids      List all available daemon IDs
-			rr --http-timeout=t       Set HTTP timeout in seconds for JSON-RPC connections
+			-r --http-timeout=t       Set HTTP timeout in seconds for JSON-RPC connections
 			-- --no-license           Suppress the GPL license prompt
 			Rr --rpc-host=HOST        Communicate with coin daemon running on host HOST
 			rr --rpc-port=PORT        Communicate with coin daemon listening on port PORT

+ 1 - 1
mmgen/rpc/local.py

@@ -52,7 +52,7 @@ class RPCClient:
 		self.host_url = f'{self.network_proto}://{host}:{port}'
 		self.host = host
 		self.port = port
-		self.timeout = self.cfg.http_timeout
+		self.timeout = self.cfg.http_timeout or 60
 		self.auth = None
 
 	def _get_backend(self, backend):