Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GuiDBTuples credit mining removal #2398

Merged
merged 4 commits into from
Oct 19, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed session and task check
  • Loading branch information
ardhipoetra committed Oct 19, 2016
commit 7c7c99b6cb0c1d078a33dd72209f26857ca26187
22 changes: 3 additions & 19 deletions Tribler/Policies/BoostingSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,6 @@ def get_source_text(self):
def _on_err(self, err_msg):
self._logger.error(err_msg)

def check_and_register_task(self, name, task, delay=None, value=None, interval=None):
"""
Helper function to avoid assertion in register task.

It will register task if it has not already registered
"""
task_ret = None
if not self.is_pending_task_active(name):
task_ret = self.register_task(name, task, delay, value, interval)

return task_ret

class ChannelSource(BoostingSource):
"""
Expand Down Expand Up @@ -201,8 +190,8 @@ def get_channel_id():
self.channel_id = self.community._channel_id

self.channel_dict = self.channelcast_db.getChannel(self.channel_id)
task_call = self.check_and_register_task(str(self.source) + "_update",
LoopingCall(self._update)).start(self.interval, now=True)
task_call = self.register_task(str(self.source) + "_update",
LoopingCall(self._update)).start(self.interval, now=True)
if task_call:
self._logger.debug("Registering update call")

Expand Down Expand Up @@ -272,7 +261,7 @@ def _update(self):
# it's highly probable the checktor function is running at this time (if it's already running)
# if not running, start the checker

task_call = self.check_and_register_task(hexlify(self.source) + "_checktor", LoopingCall(self._check_tor))
task_call = self.register_task(hexlify(self.source) + "_checktor", LoopingCall(self._check_tor))
if task_call:
self._logger.debug("Registering check torrent function")
task_call.start(self.check_torrent_interval, now=True)
Expand All @@ -289,17 +278,12 @@ def _load_torrent(self, infohash):
with TorrentDef object as parameter.
"""

# session is quitting
if self.session is None or self.session.lm.torrent_store is None or self.session.get_torrent_store() is None:
return

def add_to_loaded(infohash_str):
"""
function to add loaded infohash to memory
"""
self.loaded_torrent[unhexlify(infohash_str)].callback(
TorrentDef.load_from_memory(self.session.get_collected_torrent(unhexlify(infohash_str))))
self.loaded_torrent[unhexlify(infohash_str)] = None

if infohash not in self.loaded_torrent:
self.loaded_torrent[infohash] = defer.Deferred()
Expand Down