mirror of
https://github.com/bitwarden/server.git
synced 2025-05-28 23:04:50 -05:00
29 lines
585 B
C#
29 lines
585 B
C#
using Microsoft.Extensions.Logging;
|
|
using Quartz;
|
|
|
|
namespace Bit.Core.Jobs;
|
|
|
|
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);
|
|
}
|