mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
merge wal on shutdown
This commit is contained in:
parent
06fa78f54a
commit
195eb53995
|
@ -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
|
||||
|
|
|
@ -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]]:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue