Prevent a stall in torrentview updates if a signal isn't received
properly.
This commit is contained in:
parent
f5cc3db2d5
commit
73c14b8c47
|
@ -39,6 +39,7 @@ import gtk, gtk.glade
|
|||
import gettext
|
||||
import gobject
|
||||
import cPickle as pickle
|
||||
import time
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
|
@ -110,6 +111,7 @@ class TorrentView(listview.ListView, component.Component):
|
|||
self.load_state("torrentview.state")
|
||||
|
||||
self.status_signal_received = True
|
||||
self.status_signal_sent_time = 0
|
||||
self.previous_batched_status = {}
|
||||
|
||||
# Register the columns menu with the listview so it gets updated
|
||||
|
@ -229,6 +231,7 @@ class TorrentView(listview.ListView, component.Component):
|
|||
# We will only send another status request if we have received the
|
||||
# previous. This is to prevent things from going out of sync.
|
||||
if not self.status_signal_received:
|
||||
if time.time() - self.status_signal_sent_time < 2:
|
||||
return
|
||||
|
||||
# Store the 'status_fields' we need to send to core
|
||||
|
@ -279,6 +282,7 @@ class TorrentView(listview.ListView, component.Component):
|
|||
# will deal with the return in a signal callback.
|
||||
self.status_signal_received = False
|
||||
client.get_torrents_status(torrent_ids, status_keys)
|
||||
self.status_signal_sent_time = time.time()
|
||||
|
||||
def on_torrent_status_signal(self, status):
|
||||
"""Callback function for get_torrents_status(). 'status' should be a
|
||||
|
@ -337,6 +341,7 @@ class TorrentView(listview.ListView, component.Component):
|
|||
row,
|
||||
self.columns["torrent_id"].column_indices[0],
|
||||
torrent_id)
|
||||
self.update()
|
||||
|
||||
def remove_row(self, torrent_id):
|
||||
"""Removes a row with torrent_id"""
|
||||
|
|
Loading…
Reference in New Issue