merge wal on shutdown

This commit is contained in:
ed 2022-12-07 23:09:40 +00:00
parent 06fa78f54a
commit 195eb53995
4 changed files with 29 additions and 1 deletions

View file

@ -83,6 +83,9 @@ class HttpConn(object):
except:
pass
if self.u2idx:
self.u2idx.shutdown()
def set_rproxy(self, ip: Optional[str] = None) -> str:
if ip is None:
color = 36

View file

@ -60,6 +60,13 @@ class U2idx(object):
def log(self, msg: str, c: Union[int, str] = 0) -> None:
self.log_func("u2idx", msg, c)
def shutdown(self) -> None:
for v in self.cur.values():
try:
v.close()
except:
pass
def fsearch(
self, vols: list[tuple[str, str, dict[str, Any]]], body: dict[str, Any]
) -> list[dict[str, Any]]:

View file

@ -181,6 +181,12 @@ class Up2k(object):
all_vols = self.asrv.vfs.all_vols
have_e2d = self.init_indexes(all_vols, [])
if self.stop:
if self.pp:
self.pp.end = True
self.pp = None
return
if not self.pp and self.args.exit == "idx":
return self.hub.sigterm()
@ -3197,6 +3203,18 @@ class Up2k(object):
self.log("writing snapshot")
self.do_snapshot()
t0 = time.time()
while self.pp:
time.sleep(0.1)
if time.time() - t0 > 2:
break
for cur in self.cur.values():
try:
cur.close()
except:
pass
def up2k_chunksize(filesize: int) -> int:
chunksize = 1024 * 1024

View file

@ -98,7 +98,7 @@ class Cfg(Namespace):
def __init__(self, a=None, v=None, c=None):
ka = {}
ex = "daw dav_inf dav_mac e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js ihead magic nid nih no_acode no_athumb no_dav no_del no_dupe no_logues no_mv no_readme no_robots no_scandir no_thumb no_vthumb no_zip nw xdev xlink xvol"
ex = "daw dav_inf dav_mac e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js ihead magic nid nih no_acode no_athumb no_dav no_del no_dupe no_logues no_mv no_readme no_robots no_scandir no_sync no_thumb no_vthumb no_wal no_zip nw xdev xlink xvol"
ka.update(**{k: False for k in ex.split()})
ex = "dotpart no_rescan no_sendfile no_voldump plain_ip"