mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
optimize test_dedup.py
* 7.71s originally * 4.51s with fstab reuse * 4.34s without db_wd * 4.02s with no pp start * 3.73s with Cfg reuse
This commit is contained in:
parent
7f82449179
commit
1c9c17fb9b
|
@ -749,6 +749,8 @@ class Up2k(object):
|
|||
continue
|
||||
|
||||
self.pp = ProgressPrinter(self.log, self.args)
|
||||
if not self.hub.is_dut:
|
||||
self.pp.start()
|
||||
|
||||
break
|
||||
|
||||
|
@ -2353,7 +2355,9 @@ class Up2k(object):
|
|||
|
||||
def _open_db_wd(self, db_path: str) -> "sqlite3.Cursor":
|
||||
ok: list[int] = []
|
||||
if not self.hub.is_dut:
|
||||
Daemon(self._open_db_timeout, "opendb_watchdog", [db_path, ok])
|
||||
|
||||
try:
|
||||
return self._open_db(db_path)
|
||||
finally:
|
||||
|
|
|
@ -915,7 +915,6 @@ class ProgressPrinter(threading.Thread):
|
|||
self.msg = ""
|
||||
self.end = False
|
||||
self.n = -1
|
||||
self.start()
|
||||
|
||||
def run(self) -> None:
|
||||
sigblock()
|
||||
|
|
|
@ -54,18 +54,23 @@ class TestDedup(unittest.TestCase):
|
|||
# 3072 uploads in total
|
||||
self.ctr = 3072
|
||||
self.conn = None
|
||||
fstab = None
|
||||
for e2d in [True, False]:
|
||||
self.args = Cfg(v=[".::A"], a=[], e2d=e2d)
|
||||
for dn1, fn1, f1 in product(dirnames, filenames, files):
|
||||
for dn2, fn2, f2 in product(dirnames, filenames, files):
|
||||
for dn3, fn3, f3 in product(dirnames, filenames, files):
|
||||
self.reset()
|
||||
if self.conn:
|
||||
fstab = self.conn.hsrv.hub.up2k.fstab
|
||||
self.conn.hsrv.hub.up2k.shutdown()
|
||||
self.args = Cfg(v=[".::A"], a=[], e2d=e2d)
|
||||
self.asrv = AuthSrv(self.args, self.log)
|
||||
self.conn = tu.VHttpConn(
|
||||
self.args, self.asrv, self.log, b"", True
|
||||
)
|
||||
if fstab:
|
||||
self.conn.hsrv.hub.up2k.fstab = fstab
|
||||
|
||||
self.do_post(dn1, fn1, f1, True)
|
||||
self.do_post(dn2, fn2, f2, False)
|
||||
self.do_post(dn3, fn3, f3, False)
|
||||
|
|
Loading…
Reference in a new issue