mirror of
https://github.com/sp-tarkov/loot-dump-processor.git
synced 2025-02-13 05:30:44 -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.Collections.Concurrent;
|
||||||
|
using System.Diagnostics;
|
||||||
using LootDumpProcessor.Model.Input;
|
using LootDumpProcessor.Model.Input;
|
||||||
using LootDumpProcessor.Process.Collector;
|
using LootDumpProcessor.Process.Collector;
|
||||||
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
||||||
@ -42,8 +43,9 @@ public class QueuePipeline(
|
|||||||
private readonly List<string> _mapNames = LootDumpProcessorContext.GetConfig().MapsToProcess;
|
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
|
// Single collector instance to collect results
|
||||||
var collector = CollectorFactory.GetInstance();
|
var collector = CollectorFactory.GetInstance();
|
||||||
collector.Setup();
|
collector.Setup();
|
||||||
@ -61,6 +63,8 @@ public class QueuePipeline(
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_preProcessReader.Dispose();
|
_preProcessReader.Dispose();
|
||||||
|
stopwatch.Stop();
|
||||||
|
_logger.LogInformation("Dumps processed in {@Time}", stopwatch.Elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +210,6 @@ public class QueuePipeline(
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds map name to file if they don't have it already.
|
/// Adds map name to file if they don't have it already.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="threads">Number of threads to use</param>
|
|
||||||
private async Task FixFilesFromDumps()
|
private async Task FixFilesFromDumps()
|
||||||
{
|
{
|
||||||
var inputPath = LootDumpProcessorContext.GetConfig().ReaderConfig.DumpFilesLocation;
|
var inputPath = LootDumpProcessorContext.GetConfig().ReaderConfig.DumpFilesLocation;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using LootDumpProcessor.Process;
|
using LootDumpProcessor.Process;
|
||||||
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
using LootDumpProcessor.Process.Processor.DumpProcessor;
|
||||||
using LootDumpProcessor.Process.Processor.FileProcessor;
|
using LootDumpProcessor.Process.Processor.FileProcessor;
|
||||||
@ -19,8 +20,22 @@ public static class Program
|
|||||||
public static async Task Main()
|
public static async Task Main()
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
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.AddLogging(configure => configure.AddConsole());
|
||||||
|
|
||||||
services.AddTransient<IStaticLootProcessor, StaticLootProcessor>();
|
services.AddTransient<IStaticLootProcessor, StaticLootProcessor>();
|
||||||
services.AddTransient<IStaticContainersProcessor, StaticContainersProcessor>();
|
services.AddTransient<IStaticContainersProcessor, StaticContainersProcessor>();
|
||||||
services.AddTransient<IAmmoProcessor, AmmoProcessor>();
|
services.AddTransient<IAmmoProcessor, AmmoProcessor>();
|
||||||
@ -36,16 +51,5 @@ public static class Program
|
|||||||
services.AddTransient<IFileProcessor, FileProcessor>();
|
services.AddTransient<IFileProcessor, FileProcessor>();
|
||||||
services.AddTransient<IDumpProcessor, MultithreadSteppedDumpProcessor>();
|
services.AddTransient<IDumpProcessor, MultithreadSteppedDumpProcessor>();
|
||||||
services.AddTransient<IPipeline, QueuePipeline>();
|
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