mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-31 17:07:14 +00:00
feat(dashboard): a simpler UGC card on Diagnostics
The card had the UGC page's counts per state for both kinds, totals since the server started and the last makes, which the UGC page's lists cover. It now says whether the UGC server is up (throttled, paused), how many items wait and failed (linking to the failed ones), its busy workers, CPU, memory and stored files. /api/diagnostics/ugc read the database on a worker thread; the counts are now read on the web thread and the worker only fetches the UGC server's status. Check: Diagnostics with the UGC server enabled: the card is short, reads right while it's up, throttled and stopped, and the failed link opens the failed ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -458,9 +458,10 @@ namespace UgcRoutes {
|
||||
online = ServerState::g_UgcStatus.online;
|
||||
}
|
||||
const auto base = InternalUrl();
|
||||
Workers::Reply(reply, context, false, [base, enabled, online](HTTPReply& out) {
|
||||
nlohmann::json body = { { "success", true }, { "enabled", enabled }, { "online", online },
|
||||
{ "counts", { { "model", Counts(Database::Get()->GetUgcProcessCounts()) }, { "modular", Counts(Database::Get()->GetModularBuildProcessCounts()) } } } };
|
||||
// The database only on this thread; the worker only fetches
|
||||
nlohmann::json body = { { "success", true }, { "enabled", enabled }, { "online", online },
|
||||
{ "counts", { { "model", Counts(Database::Get()->GetUgcProcessCounts()) }, { "modular", Counts(Database::Get()->GetModularBuildProcessCounts()) } } } };
|
||||
Workers::Reply(reply, context, false, [base, enabled, body = std::move(body)](HTTPReply& out) mutable {
|
||||
if (enabled) {
|
||||
const auto fetched = CachedGet(base + "/status", eCache::STATUS);
|
||||
if (fetched->status == 200) body["status"] = nlohmann::json::parse(fetched->body, nullptr, false);
|
||||
|
||||
Reference in New Issue
Block a user