Skip to content

Commit

Permalink
improve phrasing in indexer messages (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Nov 26, 2024
1 parent 33c4ccf commit 127f414
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions copyparty/up2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@


class Dbw(object):
def __init__(self, c: "sqlite3.Cursor", n: int, t: float) -> None:
def __init__(self, c: "sqlite3.Cursor", n: int, nf: int, t: float) -> None:
self.c = c
self.n = n
self.nf = nf
self.t = t


Expand Down Expand Up @@ -1267,7 +1268,7 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]:
assert reg and self.pp # !rm
cur, db_path = reg

db = Dbw(cur, 0, time.time())
db = Dbw(cur, 0, 0, time.time())
self.pp.n = next(db.c.execute("select count(w) from up"))[0]

excl = [
Expand Down Expand Up @@ -1319,7 +1320,7 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]:
self.hub.log_stacks()

if db.n:
self.log("commit {} new files".format(db.n))
self.log("commit %d new files; %d updates" % (db.nf, db.n))

if self.args.no_dhash:
if db.c.execute("select d from dh").fetchone():
Expand Down Expand Up @@ -1621,12 +1622,13 @@ def _build_dir(
# skip upload hooks by not providing vflags
self.db_add(db.c, {}, rd, fn, lmod, sz, "", "", wark, wark, "", "", ip, at)
db.n += 1
db.nf += 1
tfa += 1
td = time.time() - db.t
if db.n >= 4096 or td >= 60:
self.log("commit {} new files".format(db.n))
self.log("commit %d new files; %d updates" % (db.nf, db.n))
db.c.connection.commit()
db.n = 0
db.n = db.nf = 0
db.t = time.time()

if not self.args.no_dhash:
Expand Down

0 comments on commit 127f414

Please sign in to comment.