2018-10-09 16:12:27 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-08-05 02:02:31 +02:00
|
|
|
|
using Bit.Core;
|
2018-10-09 16:12:27 +02:00
|
|
|
|
using Bit.Core.Jobs;
|
|
|
|
|
using Bit.Core.Repositories;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Quartz;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Admin.Jobs
|
|
|
|
|
{
|
|
|
|
|
public class DatabaseRebuildlIndexesJob : BaseJob
|
|
|
|
|
{
|
|
|
|
|
private readonly IMaintenanceRepository _maintenanceRepository;
|
|
|
|
|
|
|
|
|
|
public DatabaseRebuildlIndexesJob(
|
|
|
|
|
IMaintenanceRepository maintenanceRepository,
|
2018-10-09 20:42:11 +02:00
|
|
|
|
ILogger<DatabaseRebuildlIndexesJob> logger)
|
2018-10-09 16:12:27 +02:00
|
|
|
|
: base(logger)
|
|
|
|
|
{
|
|
|
|
|
_maintenanceRepository = maintenanceRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected async override Task ExecuteJobAsync(IJobExecutionContext context)
|
|
|
|
|
{
|
2019-08-05 02:02:31 +02:00
|
|
|
|
_logger.LogInformation(Constants.BypassFiltersEventId, "Execute job task: RebuildIndexesAsync");
|
2018-10-09 16:12:27 +02:00
|
|
|
|
await _maintenanceRepository.RebuildIndexesAsync();
|
2019-08-05 02:02:31 +02:00
|
|
|
|
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: RebuildIndexesAsync");
|
2018-10-09 16:12:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|