mirror of
https://github.com/bitwarden/server
synced 2025-12-25 12:43:14 +00:00
* Enable NRT for Core/Jobs files * Enable NRT for Core/HostedServices files * Enable NRT for Core/Exceptions files * Enable NRT for Core/NotificationHub files --------- Co-authored-by: Bernd Schoolmann <mail@quexten.com>
31 lines
603 B
C#
31 lines
603 B
C#
using Microsoft.Extensions.Logging;
|
|
using Quartz;
|
|
|
|
namespace Bit.Core.Jobs;
|
|
|
|
#nullable enable
|
|
|
|
public abstract class BaseJob : IJob
|
|
{
|
|
protected readonly ILogger _logger;
|
|
|
|
public BaseJob(ILogger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
try
|
|
{
|
|
await ExecuteJobAsync(context);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
_logger.LogError(2, e, "Error performing {0}.", GetType().Name);
|
|
}
|
|
}
|
|
|
|
protected abstract Task ExecuteJobAsync(IJobExecutionContext context);
|
|
}
|