mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
nice on windows
This commit is contained in:
parent
81f82e8e9f
commit
21e1cd87ca
|
@ -1295,7 +1295,7 @@ class HttpCli(object):
|
|||
tags[k] = v
|
||||
|
||||
if icur:
|
||||
taglist = [k for k in self.args.mte.split(",") if k in taglist]
|
||||
taglist = [k for k in vn.flags["mte"].split(",") if k in taglist]
|
||||
for f in dirs:
|
||||
f["tags"] = {}
|
||||
|
||||
|
@ -1368,7 +1368,7 @@ class HttpCli(object):
|
|||
ts=ts,
|
||||
perms=json.dumps(perms),
|
||||
taglist=taglist,
|
||||
tag_order=json.dumps(self.args.mte.split(",")),
|
||||
tag_order=json.dumps(vn.flags["mte"].split(",")),
|
||||
have_up2k_idx=("e2d" in vn.flags),
|
||||
have_tags_idx=("e2t" in vn.flags),
|
||||
logues=logues,
|
||||
|
|
|
@ -324,11 +324,15 @@ class MTag(object):
|
|||
for tagname, (binpath, timeout) in parsers.items():
|
||||
try:
|
||||
cmd = [sys.executable, binpath, abspath]
|
||||
if not WINDOWS:
|
||||
args = {"env": env, "timeout": timeout}
|
||||
|
||||
if WINDOWS:
|
||||
args["creationflags"] = 0x4000
|
||||
else:
|
||||
cmd = ["nice"] + cmd
|
||||
|
||||
cmd = [fsenc(x) for x in cmd]
|
||||
v = sp.check_output(cmd, env=env, timeout=timeout).strip()
|
||||
v = sp.check_output(cmd, **args).strip()
|
||||
if v:
|
||||
ret[tagname] = v.decode("utf-8")
|
||||
except:
|
||||
|
|
|
@ -13,6 +13,7 @@ import base64
|
|||
import hashlib
|
||||
import threading
|
||||
import traceback
|
||||
import subprocess as sp
|
||||
from copy import deepcopy
|
||||
|
||||
from .__init__ import WINDOWS
|
||||
|
@ -223,8 +224,9 @@ class Up2k(object):
|
|||
|
||||
_, flags = self._expr_idx_filter(flags)
|
||||
|
||||
a = ["\033[36m{}:\033[0m{}".format(k, v) for k, v in sorted(flags.items())]
|
||||
self.log(" ".join(a))
|
||||
a = "\033[0;36m{}:\033[1;30m{}"
|
||||
a = [a.format(k, v) for k, v in sorted(flags.items())]
|
||||
self.log(" ".join(a) + "\033[0m")
|
||||
|
||||
reg = {}
|
||||
path = os.path.join(ptop, ".hist", "up2k.snap")
|
||||
|
@ -622,6 +624,12 @@ class Up2k(object):
|
|||
self.log("mtp finished")
|
||||
|
||||
def _start_mpool(self):
|
||||
if WINDOWS and False:
|
||||
nah = open(os.devnull, "wb")
|
||||
wmic = f"processid={os.getpid()}"
|
||||
wmic = ["wmic", "process", "where", wmic, "call", "setpriority"]
|
||||
sp.call(wmic + ["below normal"], stdout=nah, stderr=nah)
|
||||
|
||||
# mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor
|
||||
# both do crazy runahead so lets reinvent another wheel
|
||||
nw = os.cpu_count() if hasattr(os, "cpu_count") else 4
|
||||
|
@ -646,6 +654,11 @@ class Up2k(object):
|
|||
|
||||
mpool.join()
|
||||
self._flush_mpool(wcur)
|
||||
if WINDOWS and False:
|
||||
nah = open(os.devnull, "wb")
|
||||
wmic = f"processid={os.getpid()}"
|
||||
wmic = ["wmic", "process", "where", wmic, "call", "setpriority"]
|
||||
sp.call(wmic + ["below normal"], stdout=nah, stderr=nah)
|
||||
|
||||
def _tag_thr(self, q):
|
||||
while True:
|
||||
|
|
Loading…
Reference in a new issue