diff --git a/Salmon.Core/Depth/StateMachine.cs b/Salmon.Core/Depth/StateMachine.cs index c98a440..3008cc5 100644 --- a/Salmon.Core/Depth/StateMachine.cs +++ b/Salmon.Core/Depth/StateMachine.cs @@ -23,12 +23,18 @@ public class StateMachine Dictionary> Implementation = new (); public bool Populated { get; private set; } = false; - public async Task PopulateWithHistory() + public async Task PopulateWithHistory() { Populated = true; + long count = 0; if (History is not null) await foreach (var i in History.GetState()) - Push(i); + { + Push(i); + count++; + } + + return count; } public void Push(Triplet triplet) diff --git a/Salmon.Web/Program.cs b/Salmon.Web/Program.cs index 8dd87fa..be37c5d 100644 --- a/Salmon.Web/Program.cs +++ b/Salmon.Web/Program.cs @@ -33,10 +33,9 @@ builder.Services.AddSingleton(); 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"); +long count = await CoreInstance.State.PopulateWithHistory(); +Console.WriteLine($"Populated with {count} triplets"); builder.Services.AddSingleton(dbInterface); -builder.Services.AddSingleton(new CurrentSoftwareRefresher(CoreInstance)); var app = builder.Build();