feat(templateMatcher): В синхронизацию неиспользуемых шаблонов добавлена метрика времени выполнения

This commit is contained in:
Mikhail Kuznetsov
2026-07-03 14:01:56 +10:00
parent 9c27f81fe8
commit fb9578fec0
3 changed files with 122 additions and 138 deletions

View File

@@ -3,11 +3,12 @@ using PARR.Core.Services.MatchingStatusService;
using PARR.Domain.Cache.Models;
using PARR.Domain.Entities.Base.History;
using PARR.Domain.Enums;
using PARR.TemplateMatcher.Services.GroupedSync;
using PARR.TemplateMatcher.Services.Implementations.GroupedSync;
using PARR.TemplateMatcher.Services.Interfaces;
using System.Diagnostics;
namespace PARR.TemplateMatcher.Services.GroupedSync;
namespace PARR.TemplateMatcher.Services.Implementations;
internal class GroupedTemplateSynchronizer : ITemplateSynchronizer
{
@@ -20,7 +21,8 @@ internal class GroupedTemplateSynchronizer : ITemplateSynchronizer
IEnumerable<IGroupedSyncStage> readStages,
IEnumerable<IGroupedSyncWriteStage> writeStages,
IMatchingStatusService matchingStatusService,
ILogger<GroupedTemplateSynchronizer> logger)
ILogger<GroupedTemplateSynchronizer> logger
)
{
_readStages = readStages;
_writeStages = writeStages;
@@ -33,7 +35,7 @@ internal class GroupedTemplateSynchronizer : ITemplateSynchronizer
_logger.LogInformation("Начало синхронизации шаблонов для JobGroup {JobGroupId}", jobGroupId);
var existingStatus = await _matchingStatusService.GetStatusAsync(jobGroupId, SyncTaskEntityTypeEnum.JobGroup);
if (existingStatus.DetailsJobGroups?.Any() == true)
if (existingStatus.DetailsJobGroups?.Count > 0)
{
_logger.LogWarning("Синхронизация для JobGroup {JobGroupId} уже запущена. Пропускаем.", jobGroupId);
return;