整理代码
This commit is contained in:
parent
fcc0de5b2a
commit
a169eecec5
@ -45,17 +45,28 @@ public class TransformService : ITransformService
|
|||||||
if (!producerQueue.TryDequeue(out var record)) continue;
|
if (!producerQueue.TryDequeue(out var record)) continue;
|
||||||
|
|
||||||
//过滤不要的record
|
//过滤不要的record
|
||||||
if (await _options.Value.RecordFilter?.Invoke(record, _cache) == false) continue;
|
|
||||||
|
if (_options.Value.RecordFilter != null)
|
||||||
|
{
|
||||||
|
var result = await _options.Value.RecordFilter.Invoke(record, _cache);
|
||||||
|
if (result == false) continue;
|
||||||
|
}
|
||||||
record.Database = _options.Value.DatabaseFilter?.Invoke(record);
|
record.Database = _options.Value.DatabaseFilter?.Invoke(record);
|
||||||
//修改record
|
//修改record
|
||||||
_options.Value.RecordModify?.Invoke(record);
|
_options.Value.RecordModify?.Invoke(record);
|
||||||
//缓存record
|
//缓存record
|
||||||
await _options.Value.RecordCache?.Invoke(record, _cache);
|
if (_options.Value.RecordCache != null)
|
||||||
//替换record
|
|
||||||
var replaceRecord = await _options.Value.RecordReplace?.Invoke(record, _cache);
|
|
||||||
if (replaceRecord != null)
|
|
||||||
{
|
{
|
||||||
record = replaceRecord;
|
await _options.Value.RecordCache.Invoke(record, _cache);
|
||||||
|
}
|
||||||
|
//替换record
|
||||||
|
if (_options.Value.RecordReplace != null)
|
||||||
|
{
|
||||||
|
var result = await _options.Value.RecordReplace.Invoke(record, _cache);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
record = result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
consumerQueue.Enqueue(record);
|
consumerQueue.Enqueue(record);
|
||||||
_context.AddTransform();
|
_context.AddTransform();
|
||||||
|
@ -445,7 +445,7 @@ async Task RunProgram()
|
|||||||
|
|
||||||
host.Services.AddHostedService<MainHostedService>();
|
host.Services.AddHostedService<MainHostedService>();
|
||||||
host.Services.AddHostedService<TaskMonitorService>();
|
host.Services.AddHostedService<TaskMonitorService>();
|
||||||
if(commandOptions.IsMock)host.Services.AddSingleton<IInputService,SimulationInputService>();
|
if(commandOptions.IsMock)host.Services.AddSingleton<IInputService,InputService>();
|
||||||
else host.Services.AddSingleton<IInputService, InputService>();
|
else host.Services.AddSingleton<IInputService, InputService>();
|
||||||
host.Services.AddSingleton<ITransformService, TransformService>();
|
host.Services.AddSingleton<ITransformService, TransformService>();
|
||||||
host.Services.AddSingleton<IOutputService, OutputService>();
|
host.Services.AddSingleton<IOutputService, OutputService>();
|
||||||
|
Loading…
Reference in New Issue
Block a user