Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Update to Lahja version that fixes logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed Feb 25, 2019
1 parent b8e534b commit ec0413b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"plyvel==1.0.5",
"py-evm==0.2.0a40",
"web3==4.4.1",
"lahja==0.11.1",
"lahja==0.11.2",
"termcolor>=1.1.0,<2.0.0",
"uvloop==0.11.2;platform_system=='Linux' or platform_system=='Darwin' or platform_system=='FreeBSD'",
"websockets==5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion trinity/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def main_entry(trinity_boot: BootFn,
if args.log_levels:
setup_log_levels(args.log_levels)

main_endpoint.track_and_propagate_available_endpoints(stderr_logger)
main_endpoint.track_and_propagate_available_endpoints()
try:
trinity_config = TrinityConfig.from_parser_args(args, app_identifier, sub_configs)
except AmbigiousFileSystem:
Expand Down
12 changes: 5 additions & 7 deletions trinity/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from typing import (
Tuple,
)
Expand Down Expand Up @@ -41,7 +40,7 @@ def connect_to_other_endpoints(self,
elif self.is_connected_to(connection_config.name):
continue
else:
self._logger.info(
self.logger.info(
"EventBus Endpoint %s connecting to other Endpoint %s",
self.name,
connection_config.name
Expand Down Expand Up @@ -73,11 +72,10 @@ class TrinityMainEventBusEndpoint(TrinityEventBusEndpoint):

available_endpoints: Tuple[ConnectionConfig, ...]

def track_and_propagate_available_endpoints(self, logger: logging.Logger) -> None:
def track_and_propagate_available_endpoints(self) -> None:
"""
Track new announced endpoints and propagate them across all other existing endpoints.
"""

self.available_endpoints = tuple()

def handle_new_endpoints(ev: EventBusConnected) -> None:
Expand All @@ -87,16 +85,16 @@ def handle_new_endpoints(ev: EventBusConnected) -> None:
# event multiple times which would then raise an exception if we are already connected
# to that endpoint.
if not self.is_connected_to(ev.connection_config.name):
logger.info(
self.logger.info(
"EventBus of main process connecting to EventBus %s", ev.connection_config.name
)
self.connect_to_endpoints_blocking(ev.connection_config)

self.available_endpoints = self.available_endpoints + (ev.connection_config,)
logger.debug("New EventBus Endpoint connected %s", ev.connection_config.name)
self.logger.debug("New EventBus Endpoint connected %s", ev.connection_config.name)
# Broadcast available endpoints to all connected endpoints, giving them
# a chance to cross connect
self.broadcast(AvailableEndpointsUpdated(self.available_endpoints))
logger.debug("Connected EventBus Endpoints %s", self.available_endpoints)
self.logger.debug("Connected EventBus Endpoints %s", self.available_endpoints)

self.subscribe(EventBusConnected, handle_new_endpoints)

0 comments on commit ec0413b

Please sign in to comment.