mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(ugc): when each creation was made and how long it took, on the UGC page
The UGC server records how long each successful make took (process_ms on ugc and ugc_modular_build; migrations sqlite 73, mysql 90). The UGC page shows it with the time it was made: in the models list's Made column (sortable, slowest first), in the tiles' tooltips, in the item preview and in an assembly's References. The gallery can sort by slowest to make too. Makes from before this are shown without a duration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,9 @@ public:
|
||||
// What the UGC server counted when it made a model: its bricks and the most detailed mesh's triangles
|
||||
virtual void SetUgcModelStats(const LWOOBJID id, const uint32_t bricks, const uint32_t triangles) = 0;
|
||||
|
||||
// How long the last successful make of a model took (process_ms), for the dashboard
|
||||
virtual void SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) = 0;
|
||||
|
||||
virtual std::optional<ProcessInfo> GetUgcProcessInfo(const LWOOBJID id) = 0;
|
||||
|
||||
// Sets models back to pending with no attempts: one (`id`), or all of them (`id` nullopt; only the failed ones
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
bool bakeAo{};
|
||||
uint32_t bricks{}; // models: counted by the UGC server when it made them (0: not yet)
|
||||
uint32_t triangles{}; // models: of the made mesh's most detailed level (0: not yet)
|
||||
uint32_t processMs{}; // how long the last successful make took (0: not made, or made before it was timed)
|
||||
};
|
||||
|
||||
// What SearchUgc matches. A number (when set) is matched against ids; text against names
|
||||
@@ -60,6 +61,7 @@ public:
|
||||
NAME, // models: the upload's file name; modular builds: the modules
|
||||
BRICKS, // models: the most bricks first
|
||||
TRIANGLES, // models: the most triangles first
|
||||
SLOWEST, // the longest last make first (process_ms)
|
||||
};
|
||||
|
||||
// A page of one kind: all of them or those matching the search (the same matching as SearchUgc), in a state or any
|
||||
|
||||
@@ -32,6 +32,9 @@ public:
|
||||
// The combination of modules a build was made as (UgcModularKey::StorageId of its modules), whose files it shares
|
||||
virtual void SetModularBuildCombination(const LWOOBJID id, const LWOOBJID combinationId) = 0;
|
||||
|
||||
// How long the last successful make of a build's icon took (process_ms), for the dashboard
|
||||
virtual void SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) = 0;
|
||||
|
||||
// Up to `limit` builds whose combination isn't recorded yet (combination_id 0): their ids and modules
|
||||
virtual std::vector<PendingBuild> GetModularBuildsWithoutCombination(const uint32_t limit) = 0;
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace UgcLookupSql {
|
||||
return (modular
|
||||
? "SELECT b.ugc_id AS id, b.character_id, c.name AS character_name, COALESCE(c.account_id, 0) AS account_id, a.name AS account_name, "
|
||||
"b.is_optimized, b.process_error, b.ldf_config AS detail, b.process_attempts, b.processed_at, 0 AS process_after, 0 AS bake_ao, "
|
||||
"0 AS brick_count, 0 AS triangle_count "
|
||||
"0 AS brick_count, 0 AS triangle_count, b.process_ms "
|
||||
: "SELECT u.id, u.character_id, c.name AS character_name, u.account_id, a.name AS account_name, "
|
||||
"u.is_optimized, u.process_error, u.filename AS detail, u.process_attempts, u.processed_at, u.process_after, u.bake_ao, "
|
||||
"u.brick_count, u.triangle_count ") + From(modular);
|
||||
"u.brick_count, u.triangle_count, u.process_ms ") + From(modular);
|
||||
}
|
||||
|
||||
// Whether a search has anything to match (else a list is of everything)
|
||||
@@ -58,6 +58,7 @@ namespace UgcLookupSql {
|
||||
case eSort::NAME: return std::string("ORDER BY ") + (modular ? "b.ldf_config" : "u.filename") + dir(false) + ", " + id + " DESC ";
|
||||
case eSort::BRICKS: return modular ? "ORDER BY " + id + dir(true) + " " : "ORDER BY u.brick_count" + std::string(dir(true)) + ", u.id DESC ";
|
||||
case eSort::TRIANGLES: return modular ? "ORDER BY " + id + dir(true) + " " : "ORDER BY u.triangle_count" + std::string(dir(true)) + ", u.id DESC ";
|
||||
case eSort::SLOWEST: return "ORDER BY " + std::string(modular ? "b" : "u") + ".process_ms" + dir(true) + ", " + id + " DESC ";
|
||||
default: return "ORDER BY " + id + dir(true) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +432,8 @@ public:
|
||||
void SetUgcFileChecksum(const eFileOwner owner, const LWOOBJID storageId, const std::string_view file, const std::string_view md5, const uint32_t size) override;
|
||||
std::optional<IUgc::FileChecksum> GetUgcFileChecksum(const LWOOBJID blueprintId, const std::string_view file) override;
|
||||
void SetModularBuildCombination(const LWOOBJID id, const LWOOBJID combinationId) override;
|
||||
void SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) override;
|
||||
void SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) override;
|
||||
std::vector<IUgcModularBuild::PendingBuild> GetModularBuildsWithoutCombination(const uint32_t limit) override;
|
||||
std::optional<IUgc::ProcessInfo> GetUgcProcessInfo(const LWOOBJID id) override;
|
||||
uint64_t ResetUgcModelProcessing(const std::optional<LWOOBJID> id, const bool failedOnly) override;
|
||||
|
||||
@@ -194,3 +194,7 @@ std::optional<IUgc::FileChecksum> MySQLDatabase::GetUgcFileChecksum(const LWOOBJ
|
||||
if (!result->next()) return std::nullopt;
|
||||
return IUgc::FileChecksum{ std::string(result->getString("md5").c_str()), static_cast<uint32_t>(result->getUInt("size")) };
|
||||
}
|
||||
|
||||
void MySQLDatabase::SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) {
|
||||
ExecuteUpdate("UPDATE ugc SET process_ms = ? WHERE id = ?;", milliseconds, id);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace {
|
||||
entry.bakeAo = result->getInt("bake_ao") != 0;
|
||||
entry.bricks = static_cast<uint32_t>(result->getInt64("brick_count"));
|
||||
entry.triangles = static_cast<uint32_t>(result->getInt64("triangle_count"));
|
||||
entry.processMs = static_cast<uint32_t>(result->getInt64("process_ms"));
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,3 +119,7 @@ std::vector<IUgcModularBuild::PendingBuild> MySQLDatabase::GetModularBuildsWitho
|
||||
}
|
||||
return builds;
|
||||
}
|
||||
|
||||
void MySQLDatabase::SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) {
|
||||
ExecuteUpdate("UPDATE ugc_modular_build SET process_ms = ? WHERE ugc_id = ?;", milliseconds, id);
|
||||
}
|
||||
|
||||
@@ -416,6 +416,8 @@ public:
|
||||
void SetUgcFileChecksum(const eFileOwner owner, const LWOOBJID storageId, const std::string_view file, const std::string_view md5, const uint32_t size) override;
|
||||
std::optional<IUgc::FileChecksum> GetUgcFileChecksum(const LWOOBJID blueprintId, const std::string_view file) override;
|
||||
void SetModularBuildCombination(const LWOOBJID id, const LWOOBJID combinationId) override;
|
||||
void SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) override;
|
||||
void SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) override;
|
||||
std::vector<IUgcModularBuild::PendingBuild> GetModularBuildsWithoutCombination(const uint32_t limit) override;
|
||||
std::optional<IUgc::ProcessInfo> GetUgcProcessInfo(const LWOOBJID id) override;
|
||||
uint64_t ResetUgcModelProcessing(const std::optional<LWOOBJID> id, const bool failedOnly) override;
|
||||
|
||||
@@ -197,3 +197,7 @@ std::optional<IUgc::FileChecksum> SQLiteDatabase::GetUgcFileChecksum(const LWOOB
|
||||
if (result.eof()) return std::nullopt;
|
||||
return IUgc::FileChecksum{ std::string(result.getStringField("md5", "")), static_cast<uint32_t>(result.getInt64Field("size")) };
|
||||
}
|
||||
|
||||
void SQLiteDatabase::SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) {
|
||||
ExecuteUpdate("UPDATE ugc SET process_ms = ? WHERE id = ?;", milliseconds, id);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace {
|
||||
entry.bakeAo = result.getIntField("bake_ao") != 0;
|
||||
entry.bricks = static_cast<uint32_t>(result.getInt64Field("brick_count"));
|
||||
entry.triangles = static_cast<uint32_t>(result.getInt64Field("triangle_count"));
|
||||
entry.processMs = static_cast<uint32_t>(result.getInt64Field("process_ms"));
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,3 +126,7 @@ std::vector<IUgcModularBuild::PendingBuild> SQLiteDatabase::GetModularBuildsWith
|
||||
}
|
||||
return builds;
|
||||
}
|
||||
|
||||
void SQLiteDatabase::SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) {
|
||||
ExecuteUpdate("UPDATE ugc_modular_build SET process_ms = ? WHERE ugc_id = ?;", milliseconds, id);
|
||||
}
|
||||
|
||||
@@ -414,6 +414,8 @@ class TestSQLDatabase : public GameDatabase {
|
||||
void SetUgcFileChecksum(const eFileOwner owner, const LWOOBJID storageId, const std::string_view file, const std::string_view md5, const uint32_t size) override {}
|
||||
std::optional<IUgc::FileChecksum> GetUgcFileChecksum(const LWOOBJID blueprintId, const std::string_view file) override { return std::nullopt; }
|
||||
void SetModularBuildCombination(const LWOOBJID id, const LWOOBJID combinationId) override {}
|
||||
void SetUgcModelProcessMs(const LWOOBJID id, const uint32_t milliseconds) override {}
|
||||
void SetModularBuildProcessMs(const LWOOBJID id, const uint32_t milliseconds) override {}
|
||||
std::vector<IUgcModularBuild::PendingBuild> GetModularBuildsWithoutCombination(const uint32_t limit) override { return {}; }
|
||||
std::optional<IUgc::ProcessInfo> GetUgcProcessInfo(const LWOOBJID id) override { return {}; }
|
||||
uint64_t ResetUgcModelProcessing(const std::optional<LWOOBJID> id, const bool failedOnly) override { return 0; }
|
||||
|
||||
Reference in New Issue
Block a user