logging: limit/disable fs-indexing progress

This commit is contained in:
ed 2025-09-19 21:05:42 +00:00
parent a043d7cfb6
commit 478f1c764e
4 changed files with 11 additions and 5 deletions

View file

@ -1578,6 +1578,9 @@ def add_logging(ap):
ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="print request \033[33mHEADER\033[0m; [\033[32m*\033[0m]=all")
ap2.add_argument("--ohead", metavar="HEADER", type=u, action='append', help="print response \033[33mHEADER\033[0m; [\033[32m*\033[0m]=all")
ap2.add_argument("--lf-url", metavar="RE", type=u, default=r"^/\.cpr/|[?&]th=[wjp]|/\.(_|ql_|DS_Store$|localized$)", help="dont log URLs matching regex \033[33mRE\033[0m")
ap2.add_argument("--scan-st-r", metavar="SEC", type=float, default=0.1, help="fs-indexing: wait \033[33mSEC\033[0m between each status-message")
ap2.add_argument("--scan-pr-r", metavar="SEC", type=float, default=10, help="fs-indexing: wait \033[33mSEC\033[0m between each 'progress:' message")
ap2.add_argument("--scan-pr-s", metavar="MiB", type=float, default=1, help="fs-indexing: say 'file: <name>' when a file larger than \033[33mMiB\033[0m is about to be hashed")
def add_admin(ap):

View file

@ -1499,6 +1499,7 @@ class Up2k(object):
th_cvd = self.args.th_coversd
th_cvds = self.args.th_coversd_set
scan_pr_s = self.args.scan_pr_s
assert self.pp and self.mem_cur # !rm
self.pp.msg = "a%d %s" % (self.pp.n, cdir)
@ -1711,7 +1712,7 @@ class Up2k(object):
if nohash or not sz:
wark = up2k_wark_from_metadata(self.salt, sz, lmod, rd, fn)
else:
if sz > 1024 * 1024:
if sz > 1024 * 1024 * scan_pr_s:
self.log("file: %r" % (abspath,))
try:

View file

@ -1121,16 +1121,18 @@ class ProgressPrinter(threading.Thread):
sigblock()
tp = 0
msg = None
no_stdout = self.args.q
slp_pr = self.args.scan_pr_r
slp_ps = min(slp_pr, self.args.scan_st_r)
no_stdout = self.args.q or slp_pr == slp_ps
fmt = " {}\033[K\r" if VT100 else " {} $\r"
while not self.end:
time.sleep(0.1)
time.sleep(slp_ps)
if msg == self.msg or self.end:
continue
msg = self.msg
now = time.time()
if msg and now - tp > 10:
if msg and now - tp >= slp_pr:
tp = now
self.log("progress: %r" % (msg,), 6)

View file

@ -155,7 +155,7 @@ class Cfg(Namespace):
ex = "gid uid"
ka.update(**{k: -1 for k in ex.split()})
ex = "hash_mt hsortn qdel safe_dedup srch_time tail_fd tail_rate th_spec_p u2abort u2j u2sz unp_who"
ex = "hash_mt hsortn qdel safe_dedup scan_pr_r scan_pr_s scan_st_r srch_time tail_fd tail_rate th_spec_p u2abort u2j u2sz unp_who"
ka.update(**{k: 1 for k in ex.split()})
ex = "ac_convt au_vol dl_list du_iwho mtab_age reg_cap s_thead s_tbody tail_tmax tail_who th_convt ups_who ver_iwho zip_who"