mirror of
https://github.com/sp-tarkov/loot-dump-processor.git
synced 2025-02-13 02:10:46 -05:00
Added performance monitoring and improved service registration organization
This commit is contained in:
parent
047372b6dc
commit
762c7ac73a
@ -1,4 +1,5 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using LootDumpProcessor.Model.Input;
|
||||
using LootDumpProcessor.Process.Collector;
|
||||
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
||||
@ -42,8 +43,9 @@ public class QueuePipeline(
|
||||
private readonly List<string> _mapNames = LootDumpProcessorContext.GetConfig().MapsToProcess;
|
||||
|
||||
|
||||
public async Task DoProcess()
|
||||
public async Task Execute()
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
// Single collector instance to collect results
|
||||
var collector = CollectorFactory.GetInstance();
|
||||
collector.Setup();
|
||||
@ -61,6 +63,8 @@ public class QueuePipeline(
|
||||
finally
|
||||
{
|
||||
_preProcessReader.Dispose();
|
||||
stopwatch.Stop();
|
||||
_logger.LogInformation("Dumps processed in {@Time}", stopwatch.Elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +210,6 @@ public class QueuePipeline(
|
||||
/// <summary>
|
||||
/// Adds map name to file if they don't have it already.
|
||||
/// </summary>
|
||||
/// <param name="threads">Number of threads to use</param>
|
||||
private async Task FixFilesFromDumps()
|
||||
{
|
||||
var inputPath = LootDumpProcessorContext.GetConfig().ReaderConfig.DumpFilesLocation;
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using LootDumpProcessor.Process;
|
||||
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
||||
using LootDumpProcessor.Process.Processor.FileProcessor;
|
||||
@ -19,8 +20,22 @@ public static class Program
|
||||
public static async Task Main()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
RegisterServices(services);
|
||||
|
||||
await using var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
// Setup Data storage
|
||||
DataStorageFactory.GetInstance().Setup();
|
||||
|
||||
// startup the pipeline
|
||||
var pipeline = serviceProvider.GetRequiredService<IPipeline>();
|
||||
await pipeline.Execute();
|
||||
}
|
||||
|
||||
private static void RegisterServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(configure => configure.AddConsole());
|
||||
|
||||
services.AddTransient<IStaticLootProcessor, StaticLootProcessor>();
|
||||
services.AddTransient<IStaticContainersProcessor, StaticContainersProcessor>();
|
||||
services.AddTransient<IAmmoProcessor, AmmoProcessor>();
|
||||
@ -36,16 +51,5 @@ public static class Program
|
||||
services.AddTransient<IFileProcessor, FileProcessor>();
|
||||
services.AddTransient<IDumpProcessor, MultithreadSteppedDumpProcessor>();
|
||||
services.AddTransient<IPipeline, QueuePipeline>();
|
||||
|
||||
await using var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
// Bootstrap the config before anything else, its required by the whole application to work
|
||||
LootDumpProcessorContext.GetConfig();
|
||||
// Setup Data storage
|
||||
DataStorageFactory.GetInstance().Setup();
|
||||
// startup the pipeline
|
||||
var pipeline = serviceProvider.GetRequiredService<IPipeline>();
|
||||
await pipeline.Execute();
|
||||
Thread.Sleep(10000);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user