< Summary

Information
Class: Services.LabelServices.LabelsFolderIndexRefreshJob
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/LabelServices/LabelsFolderIndexRefreshJob.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 33
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
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%11100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/LabelServices/LabelsFolderIndexRefreshJob.cs

#LineLine coverage
 1using Hangfire;
 2
 3namespace Services.LabelServices;
 4
 5/// <summary>
 6/// Периодически обновляет кэш <c>labels_folder_index_v1</c>,
 7/// чтобы первый заход на Orders/Index не ждал листинг папки этикеток.
 8/// </summary>
 9public class LabelsFolderIndexRefreshJob
 10{
 11    public const string JobId = "LabelsFolderIndexRefreshJob";
 12    public const string DefaultCron = "*/10 * * * *";
 13    public const string QueueName = "main";
 14
 15    private readonly ILabelExistenceService _labelExistenceService;
 16    private readonly ILabelCatalogService _labelCatalogService;
 17
 118    public LabelsFolderIndexRefreshJob(
 119        ILabelExistenceService labelExistenceService,
 120        ILabelCatalogService labelCatalogService)
 21    {
 122        _labelExistenceService = labelExistenceService;
 123        _labelCatalogService = labelCatalogService;
 124    }
 25
 26    [Queue(QueueName)]
 27    public async Task<string> ExecuteAsync()
 28    {
 129        var count = await _labelExistenceService.RefreshFolderIndexAsync();
 130        var catalog = await _labelCatalogService.RefreshAsync();
 131        return $"Labels folder index refreshed ({count} shipment numbers, {catalog.Rows.Count} PDF files)";
 132    }
 33}