From 01af7a3e36556e2422a48a23c123c409d052ec76 Mon Sep 17 00:00:00 2001 From: taywon Date: Sun, 19 May 2024 17:28:04 +0200 Subject: [PATCH] added debug info. --- Salmon.Core/Depth/StateMachine.cs | 17 +++++++++++++++++ Salmon.Web/Program.cs | 1 + 2 files changed, 18 insertions(+) diff --git a/Salmon.Core/Depth/StateMachine.cs b/Salmon.Core/Depth/StateMachine.cs index 9a575bc..c98a440 100644 --- a/Salmon.Core/Depth/StateMachine.cs +++ b/Salmon.Core/Depth/StateMachine.cs @@ -179,4 +179,21 @@ public class StateMachine return null; } + + public long CountTriplets() + { + lock(Mutex) + { + if (!Populated) + PopulateWithHistory().Wait(); + + long c = 0; + foreach (var kv in Implementation) + foreach (var i in kv.Key) + c++; + + return c; + } + + } } diff --git a/Salmon.Web/Program.cs b/Salmon.Web/Program.cs index a2cad1e..8dd87fa 100644 --- a/Salmon.Web/Program.cs +++ b/Salmon.Web/Program.cs @@ -34,6 +34,7 @@ Console.WriteLine("Connected to Mongo database."); CoreInstance.Persistence = dbInterface; CoreInstance.State.History = dbInterface; await CoreInstance.State.PopulateWithHistory(); +Console.WriteLine($"Populated with {CoreInstance.State.CountTriplets()} triplets"); builder.Services.AddSingleton(dbInterface); builder.Services.AddSingleton(new CurrentSoftwareRefresher(CoreInstance));