refactored responses
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace ParadoxSaveParser.WebAPI.BackgroundTasks;
|
||||
|
||||
public class BackgroundJobManager
|
||||
{
|
||||
private readonly ILogger _parentLogger;
|
||||
private long _lastJobId;
|
||||
|
||||
public BackgroundJobManager(ILogger logger)
|
||||
{
|
||||
_parentLogger = logger;
|
||||
}
|
||||
|
||||
public SaveParsingOperation StartNewParsingOperation(
|
||||
SaveFileMetadata meta, ISearchExpression searchQuery, CancellationToken ct)
|
||||
{
|
||||
long nextId = Interlocked.Increment(ref _lastJobId);
|
||||
var contextLogger = new ContextLogger($"BackgroundJob-{nextId}", _parentLogger);
|
||||
var op = new SaveParsingOperation(nextId, meta, searchQuery, contextLogger, ct);
|
||||
op.StartAsync();
|
||||
return op;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user