machine: replace reference to ioloop with eventloop

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-07-10 12:39:03 -04:00
parent 05e2389dc1
commit 646e97ad55
1 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,6 @@ import pathlib
import logging import logging
import platform import platform
import distro import distro
from tornado.ioloop import IOLoop
# Annotation imports # Annotation imports
from typing import ( from typing import (
@ -81,7 +80,8 @@ class Machine:
"reboot_machine", self.reboot_machine) "reboot_machine", self.reboot_machine)
# Retreive list of services # Retreive list of services
IOLoop.current().spawn_callback(self._find_active_services) event_loop = self.server.get_event_loop()
event_loop.register_callback(self._find_active_services)
async def _handle_machine_request(self, web_request: WebRequest) -> str: async def _handle_machine_request(self, web_request: WebRequest) -> str:
ep = web_request.get_endpoint() ep = web_request.get_endpoint()
@ -113,8 +113,8 @@ class Machine:
if action != "restart": if action != "restart":
raise self.server.error( raise self.server.error(
f"Service action '{action}' not available for moonraker") f"Service action '{action}' not available for moonraker")
IOLoop.current().spawn_callback( event_loop = self.server.get_event_loop()
self.do_service_action, action, name) event_loop.register_callback(self.do_service_action, action, name)
elif name in self.available_services: elif name in self.available_services:
await self.do_service_action(action, name) await self.do_service_action(action, name)
else: else: