mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
small timeout change
(re KeyError: can happen after proxy settings change)
This commit is contained in:
parent
7500b1fbee
commit
64a03c245c
2 changed files with 6 additions and 6 deletions
|
@ -213,7 +213,7 @@ class Interface(PrintError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def get_block_header(self, height, assert_mode):
|
async def get_block_header(self, height, assert_mode):
|
||||||
res = await asyncio.wait_for(self.session.send_request('blockchain.block.header', [height]), 1)
|
res = await asyncio.wait_for(self.session.send_request('blockchain.block.header', [height]), 5)
|
||||||
return blockchain.deserialize_header(bytes.fromhex(res), height)
|
return blockchain.deserialize_header(bytes.fromhex(res), height)
|
||||||
|
|
||||||
async def request_chunk(self, idx, tip):
|
async def request_chunk(self, idx, tip):
|
||||||
|
|
|
@ -32,6 +32,8 @@ import socket
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
import asyncio
|
||||||
|
import concurrent.futures
|
||||||
|
|
||||||
import dns
|
import dns
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
|
@ -42,9 +44,6 @@ from .bitcoin import COIN
|
||||||
from . import constants
|
from . import constants
|
||||||
from . import blockchain
|
from . import blockchain
|
||||||
from .interface import Interface
|
from .interface import Interface
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import concurrent.futures
|
|
||||||
from .version import PROTOCOL_VERSION
|
from .version import PROTOCOL_VERSION
|
||||||
|
|
||||||
NODES_RETRY_INTERVAL = 60
|
NODES_RETRY_INTERVAL = 60
|
||||||
|
@ -700,7 +699,8 @@ class Network(PrintError):
|
||||||
self.connection_down(interface.server)
|
self.connection_down(interface.server)
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
self.connecting.remove(server)
|
try: self.connecting.remove(server)
|
||||||
|
except KeyError: pass
|
||||||
|
|
||||||
with self.interface_lock:
|
with self.interface_lock:
|
||||||
self.interfaces[server] = interface
|
self.interfaces[server] = interface
|
||||||
|
@ -757,7 +757,7 @@ class Network(PrintError):
|
||||||
if tip is not None:
|
if tip is not None:
|
||||||
size = min(size, tip - index * 2016)
|
size = min(size, tip - index * 2016)
|
||||||
size = max(size, 0)
|
size = max(size, 0)
|
||||||
res = await session.send_request('blockchain.block.headers', [index * 2016, size])
|
res = await asyncio.wait_for(session.send_request('blockchain.block.headers', [index * 2016, size]), 20)
|
||||||
conn = self.blockchain().connect_chunk(index, res['hex'])
|
conn = self.blockchain().connect_chunk(index, res['hex'])
|
||||||
if not conn:
|
if not conn:
|
||||||
return conn, 0
|
return conn, 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue