mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-19 21:51:06 +00:00
Keep an offline Moonraker printer from freezing startup (#16668)
Moonraker discovery asked the printer for its name before announcing it, on the GUI thread, with a 5 s connect timeout. When the selected printer was off, the window ignored input for 5 s after every launch and the Home page stayed white. The request never produced a name. It read machine_name or hostname from /server/info, and Moonraker sends neither there. Discovery now announces the preset model name without asking the printer.
This commit is contained in:
1 parent
0585836550
commit
a2b1a2f3e7
2 files changed
+5
-12
No files matched your search
@@ -1415,16 +1415,8 @@ void MoonrakerPrinterAgent::announce_printhost_device()
|
||||
}
|
||||
}
|
||||
|
||||
// Try to fetch actual device name from Moonraker
|
||||
// Priority: 1) Moonraker hostname, 2) Preset model name, 3) Generic fallback
|
||||
std::string dev_name;
|
||||
MoonrakerDeviceInfo info;
|
||||
std::string fetch_error;
|
||||
if (fetch_device_info(device_info.base_url, device_info.api_key, info, fetch_error) && !info.dev_name.empty()) {
|
||||
dev_name = info.dev_name;
|
||||
} else {
|
||||
dev_name = device_info.model_name.empty() ? "Moonraker Printer" : device_info.model_name;
|
||||
}
|
||||
// Never asks the printer, since discovery runs on the GUI thread and an unreachable printer would freeze it
|
||||
const std::string dev_name = device_info.model_name.empty() ? "Moonraker Printer" : device_info.model_name;
|
||||
|
||||
const std::string model_id = device_info.model_id;
|
||||
|
||||
|
||||
@@ -420,12 +420,13 @@ TEST_CASE("Moonraker discovery waits for a complete device identity", "[Moonrake
|
||||
agent.device_info.dev_id = "127.0.0.1:7125";
|
||||
agent.device_info.dev_ip = agent.device_info.dev_id;
|
||||
agent.device_info.base_url = "http://127.0.0.1:7125";
|
||||
agent.device_info.model_name = "Test model";
|
||||
agent.start_discovery(true, false);
|
||||
REQUIRE(announcements == 1);
|
||||
REQUIRE(agent.fetch_count == 1);
|
||||
REQUIRE(agent.fetch_count == 0);
|
||||
REQUIRE(announcement.at("dev_id") == agent.device_info.dev_id);
|
||||
REQUIRE(announcement.at("dev_ip") == agent.device_info.dev_ip);
|
||||
REQUIRE(announcement.at("dev_name") == "Test printer");
|
||||
REQUIRE(announcement.at("dev_name") == "Test model");
|
||||
}
|
||||
|
||||
TEST_CASE("Stopping the status stream gives a silent printer no more than its timeouts", "[MoonrakerPrinterAgent][StatusStream]")
|
||||
|
||||
Reference in new issue
Block a user