Skip to content

Commit

Permalink
Merge pull request ethereum#541 from pipermerriam/piper/increase-disc…
Browse files Browse the repository at this point in the history
…overy-request-timeout

Increase timeout for backend peer candidate requests
  • Loading branch information
pipermerriam authored Apr 25, 2019
2 parents 2073ab3 + d645e44 commit c221409
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion p2p/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
MAX_SEQUENTIAL_PEER_CONNECT = 5

# Timeout used when fetching peer candidates from discovery
REQUEST_PEER_CANDIDATE_TIMEOUT = 0.5
REQUEST_PEER_CANDIDATE_TIMEOUT = 1

# The maximum number of concurrent attempts to establis new peer connections
MAX_CONCURRENT_CONNECTION_ATTEMPTS = 10
3 changes: 3 additions & 0 deletions tests/integration/test_trinity_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ async def test_web3(command, async_process_runner):
"Started DB server process",
"Started networking process",
"IPC started at",
# Ensure we do not start making requests that depend on the networking
# process, before it is connected to the JSON-RPC-API
"EventBus Endpoint networking connecting to other Endpoint bjson-rpc-api",
})

attached_trinity = pexpect.spawn('trinity', ['attach'], logfile=sys.stdout, encoding="utf-8")
Expand Down
7 changes: 6 additions & 1 deletion trinity/tools/async_process_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import logging
import os
import signal
from typing import (
Expand All @@ -10,6 +11,7 @@


class AsyncProcessRunner():
logger = logging.getLogger("trinity.tools.async_process_runner.AsyncProcessRunner")

def __init__(self, debug_fn: Callable[[bytes], None] = None) -> None:
self.debug_fn = debug_fn
Expand Down Expand Up @@ -64,4 +66,7 @@ async def kill_after_timeout(self, timeout_sec: int) -> None:
raise TimeoutError(f'Killed process after {timeout_sec} seconds')

def kill(self) -> None:
os.killpg(os.getpgid(self.proc.pid), signal.SIGKILL)
try:
os.killpg(os.getpgid(self.proc.pid), signal.SIGKILL)
except ProcessLookupError:
self.logger.info("Process %s has already disappeared", self.proc.pid)

0 comments on commit c221409

Please sign in to comment.