mirror of
https://github.com/sp-tarkov/loot-dump-processor.git
synced 2025-02-13 09:50:44 -05:00
Removed unused ProcessFilesFromDumps method
This commit is contained in:
parent
65b49defc9
commit
3309ec453b
@ -195,88 +195,6 @@ public class QueuePipeline(IFileProcessor fileProcessor, IDumpProcessor dumpProc
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all files and adds them to the processor.
|
|
||||||
/// use per map version now
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="threads"></param>
|
|
||||||
/// <param name="collector"></param>
|
|
||||||
private void ProcessFilesFromDumps(int threads, ICollector collector)
|
|
||||||
{
|
|
||||||
// Gather all files, sort them by date descending and then add them into the processing queue
|
|
||||||
GatherFiles().OrderByDescending(f =>
|
|
||||||
{
|
|
||||||
FileDateParser.TryParseFileDate(f, out var date);
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
).ToList().ForEach(f => _filesToProcess.Add(f));
|
|
||||||
|
|
||||||
if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Info))
|
|
||||||
{
|
|
||||||
LoggerFactory.GetInstance().Log("Files sorted and ready to begin pre-processing", LogLevel.Info);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We startup all the threads and collect them into a runners list
|
|
||||||
for (int i = 0; i < threads; i++)
|
|
||||||
{
|
|
||||||
if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Info))
|
|
||||||
{
|
|
||||||
LoggerFactory.GetInstance().Log("Creating pre-processing threads", LogLevel.Info);
|
|
||||||
}
|
|
||||||
|
|
||||||
Runners.Add(
|
|
||||||
Task.Factory.StartNew(
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
while (_filesToProcess.TryTake(out var file, TimeSpan.FromMilliseconds(5000)))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var reader = IntakeReaderFactory.GetInstance();
|
|
||||||
if (reader.Read(file, out var basicInfo))
|
|
||||||
{
|
|
||||||
collector.Hold(_fileProcessor.Process(basicInfo));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Error))
|
|
||||||
{
|
|
||||||
LoggerFactory.GetInstance().Log(
|
|
||||||
$"Error occurred while processing file {file}\n{e.Message}\n{e.StackTrace}",
|
|
||||||
LogLevel.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
TaskCreationOptions.LongRunning)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait until all runners are done processing
|
|
||||||
while (!Runners.All(r => r.IsCompleted))
|
|
||||||
{
|
|
||||||
if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Info))
|
|
||||||
{
|
|
||||||
LoggerFactory.GetInstance().Log(
|
|
||||||
$"One or more file processors are still processing files. Waiting {LootDumpProcessorContext.GetConfig().ThreadPoolingTimeoutMs}ms before checking again",
|
|
||||||
LogLevel.Info);
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.Sleep(TimeSpan.FromMilliseconds(LootDumpProcessorContext.GetConfig().ThreadPoolingTimeoutMs));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Info))
|
|
||||||
{
|
|
||||||
LoggerFactory.GetInstance().Log("Pre-processing finished", LogLevel.Info);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Single writer instance to collect results
|
|
||||||
var writer = WriterFactory.GetInstance();
|
|
||||||
// Single collector instance to collect results
|
|
||||||
writer.WriteAll(_dumpProcessor.ProcessDumps(collector.Retrieve()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessFilesFromDumpsPerMap(int threads, ICollector collector, string mapName)
|
private void ProcessFilesFromDumpsPerMap(int threads, ICollector collector, string mapName)
|
||||||
{
|
{
|
||||||
// Gather all files, sort them by date descending and then add them into the processing queue
|
// Gather all files, sort them by date descending and then add them into the processing queue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user