moonraker: remove unnecessary "check_ready" request.

There is no longer a need for Moonraker to check in with Klippy's `moonraker/check_ready` request.  It can now simply check in with the "info" request.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-08-01 08:28:35 -04:00
parent 0d29d0f811
commit 4191aac63f
2 changed files with 16 additions and 11 deletions

View File

@ -21,7 +21,7 @@ MAX_UPLOAD_SIZE = 200 * 1024 * 1024
# These endpoints are reserved for klippy/server communication only and are
# not exposed via http or the websocket
RESERVED_ENDPOINTS = [
"list_endpoints", "moonraker/check_ready", "moonraker/get_configuration"
"list_endpoints", "moonraker/get_configuration"
]

View File

@ -218,8 +218,11 @@ class Server:
await self._request_endpoints()
if not self.server_configured:
await self._request_config()
await self._request_ready()
if self.is_klippy_ready:
if not self.is_klippy_ready:
await self._request_ready()
if self.is_klippy_ready and self.server_configured:
# Make sure we have all registered endpoints
await self._request_endpoints()
self.init_cb.stop()
async def _request_endpoints(self):
@ -243,22 +246,24 @@ class Server:
self.server_configured = True
else:
logging.info(
"\nError receiving configuration. This indicates a potential\n"
"configuration issue in printer.cfg. Please check klippy.log\n"
"for more information")
"Error receiving configuration. This indicates a "
"potential configuration issue in printer.cfg. Please check "
"klippy.log for more information")
async def _request_ready(self):
request = self.make_request(
"moonraker/check_ready", "GET", {})
request = self.make_request("info", "GET", {})
result = await request.wait()
if not isinstance(result, ServerError):
is_ready = result.get("is_ready", False)
if is_ready:
self._set_klippy_ready()
if not self.is_klippy_ready:
else:
msg = result.get("message", "Klippy Not Ready")
logging.info(msg)
else:
logging.info(
"\nKlippy not ready. This indicates a that Klippy may have\n"
"experienced an error during startup. Please check\n"
"Klippy Info request error. This indicates a that Klippy "
"may have experienced an error during startup. Please check "
"klippy.log for more information")
def _load_config(self, config):