fix: snapshot Moonraker connection state and make agent teardown responsive

This commit is contained in:
Ian Chua
2026-10-07 16:58:13 +08:00
parent 5e3a526b72
commit 5b81536be2
7 changed files with 95 additions and 43 deletions
+3 -3
View File
@@ -219,9 +219,9 @@ public:
std::thread([this, finish = std::move(allow_finish_p)] {
struct InFlightGuard
{
std::atomic<int>& counter;
~InFlightGuard() { counter.fetch_sub(1, std::memory_order_relaxed); }
} guard{filament_fetch_in_flight};
MoonrakerPrinterAgent& owner;
~InFlightGuard() { owner.release_fetch_slot(); }
} guard{*this};
g_deferred_fetch_running.fetch_add(1, std::memory_order_relaxed);
finish->get_future().wait();