diff options
| author | Stefan Boberg <[email protected]> | 2026-04-05 19:33:14 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-05 19:33:14 +0200 |
| commit | 922b512ee0d58f74e66e348b000d613921ad9ecd (patch) | |
| tree | ef645ef4a68d624af5c658f213821d2c777d68dc /src/zenhorde | |
| parent | add compressed file upload path gated on ComputeProtocol version (diff) | |
| download | zen-sb/horde-compressedbuffer.tar.xz zen-sb/horde-compressedbuffer.zip | |
defer bundle creation to legacy upload pathsb/horde-compressedbuffer
Bundle creation is now lazy — it only runs when an agent actually needs
the legacy WriteFiles/ReadBlob protocol. When all agents support
CompressedFileTransfer, no bundles are created at all.
Diffstat (limited to 'src/zenhorde')
| -rw-r--r-- | src/zenhorde/hordeprovisioner.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/zenhorde/hordeprovisioner.cpp b/src/zenhorde/hordeprovisioner.cpp index 79dacf57e..825f78c78 100644 --- a/src/zenhorde/hordeprovisioner.cpp +++ b/src/zenhorde/hordeprovisioner.cpp @@ -146,14 +146,10 @@ HordeProvisioner::ThreadAgent(AgentWrapper& Wrapper) auto $ = MakeGuard([&] { m_EstimatedCoreCount.fetch_sub(EstimatedCoresPerAgent); }); { - ZEN_TRACE_CPU("HordeProvisioner::CreateBundles"); - std::lock_guard<std::mutex> BundleLock(m_BundleLock); - if (!m_BundlesCreated) + if (m_BinaryFiles.empty()) { - const std::filesystem::path OutputDir = m_WorkingDir / "horde_bundles"; - #if ZEN_PLATFORM_WINDOWS m_BinaryFiles.push_back({m_BinariesPath / "zenserver.exe", false}); #elif ZEN_PLATFORM_LINUX @@ -162,23 +158,6 @@ HordeProvisioner::ThreadAgent(AgentWrapper& Wrapper) #elif ZEN_PLATFORM_MAC m_BinaryFiles.push_back({m_BinariesPath / "zenserver", false}); #endif - - std::vector<BundleFile> BundleFiles; - for (const BinaryFileEntry& Entry : m_BinaryFiles) - { - BundleFiles.emplace_back(Entry.Path, Entry.Optional); - } - - BundleResult Result; - if (!BundleCreator::CreateBundle(BundleFiles, OutputDir, Result)) - { - ZEN_WARN("failed to create bundle, cannot provision any agents!"); - m_AskForAgents.store(false); - return; - } - - m_Bundles.emplace_back(Result.Locator, Result.BundleDir); - m_BundlesCreated = true; } if (!m_HordeClient) @@ -303,7 +282,33 @@ HordeProvisioner::ThreadAgent(AgentWrapper& Wrapper) } else { - // Legacy bundle upload + // Legacy bundle upload — create bundles lazily on first use + { + std::lock_guard<std::mutex> BundleLock(m_BundleLock); + if (!m_BundlesCreated) + { + ZEN_TRACE_CPU("HordeProvisioner::CreateBundles"); + + const std::filesystem::path OutputDir = m_WorkingDir / "horde_bundles"; + + std::vector<BundleFile> BundleFiles; + for (const BinaryFileEntry& Entry : m_BinaryFiles) + { + BundleFiles.emplace_back(Entry.Path, Entry.Optional); + } + + BundleResult Result; + if (!BundleCreator::CreateBundle(BundleFiles, OutputDir, Result)) + { + ZEN_WARN("failed to create bundle, cannot provision any agents!"); + return; + } + + m_Bundles.emplace_back(Result.Locator, Result.BundleDir); + m_BundlesCreated = true; + } + } + for (auto& [Locator, BundleDir] : m_Bundles) { if (Wrapper.ShouldExit.load()) |