From 7729d14fa4bda41154222fe0c745d5a586730164 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Thu, 1 Oct 2026 03:16:56 -0500 Subject: [PATCH] feat(ugc): queue_on_property_save: only queued models are made, a property's are queued when it is saved Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/PropertyManagementComponent.cpp | 2 ++ dUgcServer/Processing/UgcProcessor.cpp | 4 ++-- dUgcServer/Processing/UgcProcessor.h | 1 + dUgcServer/UgcServer.cpp | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 3c86f2aaf..baa26f730 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -838,6 +838,8 @@ void PropertyManagementComponent::Save() { info.id = propertyId; info.lastUpdatedTime = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); Database::Get()->UpdateLastSave(info); + // Its models may be made now (the UGC setting queue_on_property_save makes only queued ones) + Database::Get()->QueuePropertyUgcModels(propertyId); DashboardNotify::Changed("properties", propertyId); } diff --git a/dUgcServer/Processing/UgcProcessor.cpp b/dUgcServer/Processing/UgcProcessor.cpp index ce95c6150..a4082ec95 100644 --- a/dUgcServer/Processing/UgcProcessor.cpp +++ b/dUgcServer/Processing/UgcProcessor.cpp @@ -420,8 +420,8 @@ void UgcProcessor::Poll() { std::vector jobs; std::vector models; // Models staff asked to be made again come first too: polled even when the queue is full, to its front - if (limit > 0) models = Database::Get()->GetUgcModelsToProcess(limit); - else models = Database::Get()->GetUgcModelsToProcess(buildLimit, true); + if (limit > 0) models = Database::Get()->GetUgcModelsToProcess(limit, false, limits.queuedOnly); + else models = Database::Get()->GetUgcModelsToProcess(buildLimit, true, limits.queuedOnly); for (auto& model : models) { if (m_InFlight.contains({ Kind::MODEL, model.id })) continue; Job job{ Kind::MODEL, model.id, model.attempts, UgcJobs::LxfmlFromBlob(model.lxfml) }; diff --git a/dUgcServer/Processing/UgcProcessor.h b/dUgcServer/Processing/UgcProcessor.h index 12de2ba5c..0d44ecde5 100644 --- a/dUgcServer/Processing/UgcProcessor.h +++ b/dUgcServer/Processing/UgcProcessor.h @@ -50,6 +50,7 @@ public: int nice{}; // the workers' scheduling priority (Linux nice, 0 to 19) int pauseFromHour{ -1 }; // local hours in which no new jobs start (from, to; -1: never) int pauseToHour{ -1 }; + bool queuedOnly{}; // queue_on_property_save: only models queued (saved, made again, property saved) }; UgcProcessor(Config config, UgcStorage& storage, UgcBricks::BrickLibrary& library, UgcJobs::Settings settings); diff --git a/dUgcServer/UgcServer.cpp b/dUgcServer/UgcServer.cpp index 7bd8c46ae..9197fbfa3 100644 --- a/dUgcServer/UgcServer.cpp +++ b/dUgcServer/UgcServer.cpp @@ -251,6 +251,7 @@ namespace { limits.maxMemoryBytes = Setting("max_memory_mb", 0) * 1024 * 1024; limits.nice = std::clamp(Setting("worker_nice", 0), 0, 19); UgcThrottle::ParseHours(Game::config->GetValue("pause_hours"), limits.pauseFromHour, limits.pauseToHour); + limits.queuedOnly = Game::config->GetValue("queue_on_property_save") == "1"; return limits; }