mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
faster tagscanning of zerobyte files
This commit is contained in:
parent
fd552842d4
commit
655f6d00f8
|
@ -154,7 +154,7 @@ class Up2k(object):
|
||||||
self.hashq: Queue[
|
self.hashq: Queue[
|
||||||
tuple[str, str, dict[str, Any], str, str, str, float, str, bool]
|
tuple[str, str, dict[str, Any], str, str, str, float, str, bool]
|
||||||
] = Queue()
|
] = Queue()
|
||||||
self.tagq: Queue[tuple[str, str, str, str, str, float]] = Queue()
|
self.tagq: Queue[tuple[str, str, str, str, int, str, float]] = Queue()
|
||||||
self.tag_event = threading.Condition()
|
self.tag_event = threading.Condition()
|
||||||
self.hashq_mutex = threading.Lock()
|
self.hashq_mutex = threading.Lock()
|
||||||
self.n_hashq = 0
|
self.n_hashq = 0
|
||||||
|
@ -2055,12 +2055,13 @@ class Up2k(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
st = bos.stat(qe.abspath)
|
||||||
if not qe.mtp:
|
if not qe.mtp:
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
t = "tag-thr: {}({})"
|
t = "tag-thr: {}({})"
|
||||||
self.log(t.format(self.mtag.backend, qe.abspath), "90")
|
self.log(t.format(self.mtag.backend, qe.abspath), "90")
|
||||||
|
|
||||||
tags = self.mtag.get(qe.abspath)
|
tags = self.mtag.get(qe.abspath) if st.st_size else {}
|
||||||
else:
|
else:
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
t = "tag-thr: {}({})"
|
t = "tag-thr: {}({})"
|
||||||
|
@ -2101,11 +2102,16 @@ class Up2k(object):
|
||||||
"""will mutex"""
|
"""will mutex"""
|
||||||
assert self.mtag
|
assert self.mtag
|
||||||
|
|
||||||
if not bos.path.isfile(abspath):
|
try:
|
||||||
|
st = bos.stat(abspath)
|
||||||
|
except:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if not stat.S_ISREG(st.st_mode):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tags = self.mtag.get(abspath)
|
tags = self.mtag.get(abspath) if st.st_size else {}
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self._log_tag_err("", abspath, ex)
|
self._log_tag_err("", abspath, ex)
|
||||||
return 0
|
return 0
|
||||||
|
@ -3098,7 +3104,7 @@ class Up2k(object):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if "e2t" in self.flags[ptop]:
|
if "e2t" in self.flags[ptop]:
|
||||||
self.tagq.put((ptop, wark, rd, fn, ip, at))
|
self.tagq.put((ptop, wark, rd, fn, sz, ip, at))
|
||||||
self.n_tagq += 1
|
self.n_tagq += 1
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -4056,14 +4062,14 @@ class Up2k(object):
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
self.n_tagq -= 1
|
self.n_tagq -= 1
|
||||||
|
|
||||||
ptop, wark, rd, fn, ip, at = self.tagq.get()
|
ptop, wark, rd, fn, sz, ip, at = self.tagq.get()
|
||||||
if "e2t" not in self.flags[ptop]:
|
if "e2t" not in self.flags[ptop]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# self.log("\n " + repr([ptop, rd, fn]))
|
# self.log("\n " + repr([ptop, rd, fn]))
|
||||||
abspath = djoin(ptop, rd, fn)
|
abspath = djoin(ptop, rd, fn)
|
||||||
try:
|
try:
|
||||||
tags = self.mtag.get(abspath)
|
tags = self.mtag.get(abspath) if sz else {}
|
||||||
ntags1 = len(tags)
|
ntags1 = len(tags)
|
||||||
parsers = self._get_parsers(ptop, tags, abspath)
|
parsers = self._get_parsers(ptop, tags, abspath)
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
|
|
Loading…
Reference in a new issue