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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 03:16:56 -05:00
parent 5ad1a75da5
commit 7729d14fa4
4 changed files with 6 additions and 2 deletions

View File

@@ -838,6 +838,8 @@ void PropertyManagementComponent::Save() {
info.id = propertyId;
info.lastUpdatedTime = std::chrono::duration_cast<std::chrono::seconds>(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);
}

View File

@@ -420,8 +420,8 @@ void UgcProcessor::Poll() {
std::vector<Job> jobs;
std::vector<IUgc::PendingModel> 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) };

View File

@@ -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);

View File

@@ -251,6 +251,7 @@ namespace {
limits.maxMemoryBytes = Setting<uint64_t>("max_memory_mb", 0) * 1024 * 1024;
limits.nice = std::clamp(Setting<int32_t>("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;
}