app_deploy: replace reference to ioloop with eventloop
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
c4796ee321
commit
d52554231a
|
@ -8,8 +8,6 @@ from __future__ import annotations
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
import hashlib
|
import hashlib
|
||||||
from concurrent.futures.thread import ThreadPoolExecutor
|
|
||||||
from tornado.ioloop import IOLoop
|
|
||||||
from .base_deploy import BaseDeploy
|
from .base_deploy import BaseDeploy
|
||||||
|
|
||||||
# Annotation imports
|
# Annotation imports
|
||||||
|
@ -143,8 +141,8 @@ class AppDeploy(BaseDeploy):
|
||||||
if self.name == "moonraker":
|
if self.name == "moonraker":
|
||||||
# Launch restart async so the request can return
|
# Launch restart async so the request can return
|
||||||
# before the server restarts
|
# before the server restarts
|
||||||
IOLoop.current().call_later(
|
event_loop = self.server.get_event_loop()
|
||||||
.1, self._do_restart) # type: ignore
|
event_loop.delay_callback(.1, self._do_restart)
|
||||||
else:
|
else:
|
||||||
await self._do_restart()
|
await self._do_restart()
|
||||||
|
|
||||||
|
@ -178,9 +176,8 @@ class AppDeploy(BaseDeploy):
|
||||||
def hash_func(f: pathlib.Path) -> str:
|
def hash_func(f: pathlib.Path) -> str:
|
||||||
return hashlib.sha256(f.read_bytes()).hexdigest()
|
return hashlib.sha256(f.read_bytes()).hexdigest()
|
||||||
try:
|
try:
|
||||||
with ThreadPoolExecutor(max_workers=1) as tpe:
|
event_loop = self.server.get_event_loop()
|
||||||
return await IOLoop.current().run_in_executor(
|
return await event_loop.run_in_thread(hash_func, filename)
|
||||||
tpe, hash_func, filename)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue