mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 19:26:25 +00:00
DownloadStatus: show active immutable downloads in Active Operations, Fix #1172
This commit is contained in:
parent
cdc625e0f8
commit
485bfc0fd6
@ -202,8 +202,15 @@ class DownloadStatus:
|
||||
|
||||
def using_helper(self):
|
||||
return False
|
||||
|
||||
def get_active(self):
|
||||
return False # TODO
|
||||
# a download is considered active if it has at least one outstanding
|
||||
# read() call
|
||||
for r_ev in self.read_events:
|
||||
if r_ev["finish_time"] is None:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_started(self):
|
||||
return self.started
|
||||
def get_results(self):
|
||||
|
@ -1259,6 +1259,19 @@ class Status(unittest.TestCase):
|
||||
e2.finished(now+5)
|
||||
self.failUnlessEqual(ds.get_progress(), 1.0)
|
||||
|
||||
def test_active(self):
|
||||
now = 12345.1
|
||||
ds = DownloadStatus("si-1", 123)
|
||||
self.failUnlessEqual(ds.get_active(), False)
|
||||
e1 = ds.add_read_event(0, 1000, now)
|
||||
self.failUnlessEqual(ds.get_active(), True)
|
||||
e2 = ds.add_read_event(1, 1000, now+1)
|
||||
self.failUnlessEqual(ds.get_active(), True)
|
||||
e1.finished(now+2)
|
||||
self.failUnlessEqual(ds.get_active(), True)
|
||||
e2.finished(now+3)
|
||||
self.failUnlessEqual(ds.get_active(), False)
|
||||
|
||||
class MyShare:
|
||||
def __init__(self, shnum, peerid, rtt):
|
||||
self._shnum = shnum
|
||||
|
Loading…
Reference in New Issue
Block a user