Skip to content

Commit

Permalink
Improved test coverage and resolved review comments
Browse files Browse the repository at this point in the history
Renamed popular community to popularity community and added identifier to subscription request
  • Loading branch information
xoriole committed Jun 29, 2018
1 parent 48ce072 commit 9962ed6
Show file tree
Hide file tree
Showing 20 changed files with 1,014 additions and 664 deletions.
16 changes: 8 additions & 8 deletions Tribler/Core/APIImplementation/LaunchManyCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(self):
self.tunnel_community = None
self.trustchain_community = None
self.wallets = {}
self.popular_community = None
self.popularity_community = None

self.startup_deferred = Deferred()

Expand Down Expand Up @@ -289,19 +289,19 @@ def load_ipv8_overlays(self):
self.ipv8.strategies.append((RandomWalk(self.market_community), 20))

# Popular Community
if self.session.config.get_popular_community_enabled():
from Tribler.community.popular.community import PopularCommunity
if self.session.config.get_popularity_community_enabled():
from Tribler.community.popularity.community import PopularityCommunity

local_peer = Peer(self.session.trustchain_keypair)

self.popular_community = PopularCommunity(local_peer, self.ipv8.endpoint, self.ipv8.network,
torrent_db=self.session.lm.torrent_db, session=self.session)
self.popularity_community = PopularityCommunity(local_peer, self.ipv8.endpoint, self.ipv8.network,
torrent_db=self.session.lm.torrent_db, session=self.session)

self.ipv8.overlays.append(self.popular_community)
self.ipv8.overlays.append(self.popularity_community)

self.ipv8.strategies.append((RandomWalk(self.popular_community), 20))
self.ipv8.strategies.append((RandomWalk(self.popularity_community), 20))

self.popular_community.start()
self.popularity_community.start()

@blocking_call_on_reactor_thread
def load_dispersy_communities(self):
Expand Down
2 changes: 1 addition & 1 deletion Tribler/Core/Config/config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ enabled = boolean(default=True)
sources = string_list(default=list())
max_disk_space = integer(min=0, default=53687091200)

[popular_community]
[popularity_community]
enabled = boolean(default=True)
cache_dir = string(default=health_cache)
8 changes: 4 additions & 4 deletions Tribler/Core/Config/tribler_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,11 @@ def get_dummy_wallets_enabled(self):

# Popular Community

def get_popular_community_enabled(self):
return self.config['popular_community']['enabled']
def get_popularity_community_enabled(self):
return self.config['popularity_community']['enabled']

def set_popular_community_enabled(self, value):
self.config['popular_community']['enabled'] = value
def set_popularity_community_enabled(self, value):
self.config['popularity_community']['enabled'] = value

# Torrent store

Expand Down
6 changes: 3 additions & 3 deletions Tribler/Core/Modules/search_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def search_for_torrents(self, keywords):
break

self._current_keywords = keywords
# If popular community is enabled, send the search request there as well
if self.session.lm.popular_community:
self.session.lm.popular_community.send_torrent_search_request(keywords)
# If popularity community is enabled, send the search request there as well
if self.session.lm.popularity_community:
self.session.lm.popularity_community.send_torrent_search_request(keywords)

return nr_requests_made

Expand Down
8 changes: 4 additions & 4 deletions Tribler/Core/TorrentChecker/torrent_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from Tribler.Core.TorrentChecker.session import create_tracker_session, FakeDHTSession, UdpSocketManager
from Tribler.Core.Utilities.tracker_utils import MalformedTrackerURLException
from Tribler.Core.simpledefs import NTFY_TORRENTS
from Tribler.community.popular.repository import TYPE_TORRENT_HEALTH
from Tribler.community.popularity.repository import TYPE_TORRENT_HEALTH
from Tribler.dispersy.util import blocking_call_on_reactor_thread, call_on_reactor_thread
from Tribler.pyipv8.ipv8.taskmanager import TaskManager

Expand Down Expand Up @@ -199,7 +199,7 @@ def on_gui_request_completed(self, infohash, result):

self._update_torrent_result(torrent_update_dict)

# Add this result to popular community to publish to subscribers
# Add this result to popularity community to publish to subscribers
self.publish_torrent_result(torrent_update_dict)

return final_response
Expand Down Expand Up @@ -336,7 +336,7 @@ def publish_torrent_result(self, response):
self._logger.info("Not publishing zero seeded torrents")
return
content = (response['infohash'], response['seeders'], response['leechers'], response['last_check'])
if self.tribler_session.lm.popular_community:
self.tribler_session.lm.popular_community.queue_content(TYPE_TORRENT_HEALTH, content)
if self.tribler_session.lm.popularity_community:
self.tribler_session.lm.popularity_community.queue_content(TYPE_TORRENT_HEALTH, content)
else:
self._logger.info("Popular community not available to publish torrent checker result")
142 changes: 0 additions & 142 deletions Tribler/Test/Community/popular/test_repository.py

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 9962ed6

Please sign in to comment.