Fix monitoring plugin (#3191)

* Misc.

* Fix ASF crash

* Remove warning about automatic update of custom plugins if there is only official plugins enabled

* Fix previous mistake

* Revert "Fix ASF crash"

This reverts commit 42209e93ce.
This commit is contained in:
Sebastian Göls
2024-04-21 16:21:33 +02:00
committed by GitHub
parent d013366c9a
commit e2a5ec3616
2 changed files with 4 additions and 2 deletions

View File

@@ -198,7 +198,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IDisposable, IGitHubPlu
$"{MetricNamePrefix}_bot_farming_time_remaining_{Units.Minutes}", static () => {
IEnumerable<Bot> bots = Bot.Bots?.Values ?? [];
return bots.Select(static bot => new Measurement<double>(bot.CardsFarmer.TimeRemaining.TotalMinutes, new KeyValuePair<string, object?>(TagNames.BotName, bot.BotName), new KeyValuePair<string, object?>(TagNames.SteamID, bot.SteamID)));
return bots.Where(static bot => bot.IsConnectedAndLoggedOn).Select(static bot => new Measurement<double>(bot.CardsFarmer.TimeRemaining.TotalMinutes, new KeyValuePair<string, object?>(TagNames.BotName, bot.BotName), new KeyValuePair<string, object?>(TagNames.SteamID, bot.SteamID)));
},
Units.Minutes,
"Approximate number of minutes remaining until each bot has finished farming all cards"

View File

@@ -305,7 +305,9 @@ public static class PluginsCore {
}
if (activePluginUpdates.Count > 0) {
ASF.ArchiLogger.LogGenericWarning(Strings.CustomPluginUpdatesEnabled);
if (activePluginUpdates.Any(static plugin => plugin is not OfficialPlugin)) {
ASF.ArchiLogger.LogGenericWarning(Strings.CustomPluginUpdatesEnabled);
}
ActivePluginUpdates = activePluginUpdates.ToFrozenSet();
}