Skip to content

Commit

Permalink
Merge pull request #118 from HathorNetwork/dev
Browse files Browse the repository at this point in the history
Release v0.1.17
  • Loading branch information
r4mmer authored Jan 11, 2022
2 parents e2c5edb + 86e8c06 commit 81236de
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hathor-explorer-service",
"version": "0.1.16",
"version": "0.1.17",
"description": "Hathor Explorer Service Serverless deps",
"dependencies": {
"serverless": "^2.44.0",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hathor-explorer-service"
version = "0.1.16"
version = "0.1.17"
description = ""
authors = ["Hathor Labs <[email protected]>"]
license = "MIT"
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/usecases/test_collect_nodes_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def node_gateway(self):
@patch('usecases.collect_nodes_statuses.HATHOR_NODES', ['a', 'b'])
async def test_collect(self, node_gateway):
node = Node.from_status_dict(HATHOR_CORE_MAINNET_GET_STATUS)
# XXX: filtering known_peers based on connected_peers
connected_peer_ids = map(lambda p: p.id, node.connected_peers)
node.known_peers = [
peer_id for peer_id in connected_peer_ids if peer_id in node.known_peers
]

node_gateway.get_node_status_async = AsyncMock(side_effect=lambda x: x(HATHOR_CORE_MAINNET_GET_STATUS))
with patch.object(NodeGateway, 'get_node_status_async', new=node_gateway.get_node_status_async):
Expand Down
7 changes: 7 additions & 0 deletions usecases/collect_nodes_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ def _send(self, data: dict) -> None:
self.log.warning("collect_status_error", error=data['error'])
return
node = Node.from_status_dict(data)
# XXX: https://github.com/HathorNetwork/internal-issues/issues/73
# A big enough known_peers list can reach the limit of data passed to a lambda.
# This filters the unnecessary peer ids.
connected_peer_ids = map(lambda p: p.id, node.connected_peers)
node.known_peers = [
peer_id for peer_id in connected_peer_ids if peer_id in node.known_peers
]
self.node_gateway.send_node_to_data_aggregator(node)

0 comments on commit 81236de

Please sign in to comment.