< Summary

Information
Class: Services.SearchServices.OrderSearch.OrderSearchDriftRepairJob
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/SearchServices/OrderSearch/OrderSearchDriftRepairJob.cs
Line coverage
91%
Covered lines: 11
Uncovered lines: 1
Coverable lines: 12
Total lines: 41
Line coverage: 91.6%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ExecuteAsync()100%4488.88%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/SearchServices/OrderSearch/OrderSearchDriftRepairJob.cs

#LineLine coverage
 1using Hangfire;
 2using Services.SignalRServices;
 3using Services.HangfireService;
 4
 5namespace Services.SearchServices.OrderSearch;
 6
 7/// <summary>
 8/// Точечное исправление расхождения ES↔MySQL: доиндексация отсутствующих заказов и удаление сирот в индексе.
 9/// Запускается вручную из JobLogs или через Hangfire Dashboard.
 10/// </summary>
 11public class OrderSearchDriftRepairJob
 12{
 13    public const string JobId = "OrderSearchDriftRepairJob";
 14    public const string QueueName = HangfireQueueNames.OrderSearch;
 15
 16    private readonly IOrderSearchSyncService _syncService;
 17
 218    public OrderSearchDriftRepairJob(IOrderSearchSyncService syncService)
 19    {
 220        _syncService = syncService;
 221    }
 22
 23    [Queue(QueueName)]
 24    public async Task<string> ExecuteAsync(string? triggeredBy = null)
 25    {
 226        var trigger = string.IsNullOrWhiteSpace(triggeredBy) ? "Manual" : $"Manual:{triggeredBy.Trim()}";
 227        var result = await _syncService.RepairDriftAsync(trigger);
 28
 229        if (!result.Skipped)
 30        {
 31            try
 32            {
 233                await NotificationService.NotifyAsync(
 234                    "ES Индекс", "#8B5CF6", result.Message, "fa-wrench");
 035            }
 436            catch { /* не роняем джоб */ }
 37        }
 38
 239        return result.Message;
 240    }
 41}