mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) };
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user