< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Data.RefreshDatabaseStatisticsPostScanTask
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Data/RefreshDatabaseStatisticsPostScanTask.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 35
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

Coverage history

Coverage history 0 25 50 75 100 10/29/2026 - 12:17:11 AM Line coverage: 100% (5/5) Total lines: 35

Metrics

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

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Data/RefreshDatabaseStatisticsPostScanTask.cs

#LineLine coverage
 1using System;
 2using System.Threading;
 3using System.Threading.Tasks;
 4using Jellyfin.Database.Implementations;
 5using MediaBrowser.Controller.Library;
 6
 7namespace Emby.Server.Implementations.Data;
 8
 9/// <summary>
 10/// Refreshes the database statistics after every library scan.
 11/// </summary>
 12/// <remarks>
 13/// The scheduled optimization skips itself while a scan runs, so without this the first scan of a new server
 14/// leaves every query planned for an empty library until the next scheduled run.
 15/// </remarks>
 16public class RefreshDatabaseStatisticsPostScanTask : ILibraryPostScanTask
 17{
 18    private readonly IJellyfinDatabaseProvider _databaseProvider;
 19
 20    /// <summary>
 21    /// Initializes a new instance of the <see cref="RefreshDatabaseStatisticsPostScanTask"/> class.
 22    /// </summary>
 23    /// <param name="databaseProvider">The database provider.</param>
 24    public RefreshDatabaseStatisticsPostScanTask(IJellyfinDatabaseProvider databaseProvider)
 25    {
 2726        _databaseProvider = databaseProvider;
 2727    }
 28
 29    /// <inheritdoc />
 30    public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
 31    {
 2032        await _databaseProvider.RefreshStatistics(cancellationToken).ConfigureAwait(false);
 2033        progress.Report(100);
 2034    }
 35}