Files
annotations/Web/Azaion.Web/Azaion.Repository/Jobs/BaseJob.cs
T
Oleksandr Bezdieniezhnykh 7807f5bc90 add quartz for jobs
configure auto-scan folder and create hls files job WIP
2024-07-26 14:11:29 +03:00

28 lines
719 B
C#

using Microsoft.Extensions.Logging;
using Quartz;
namespace Azaion.Repository.Jobs
{
[DisallowConcurrentExecution]
public abstract class BaseJob(ILogger<BaseJob> logger) : IJob
{
protected abstract Task ExecuteInner(IJobExecutionContext context);
public async Task Execute(IJobExecutionContext context)
{
logger.LogDebug($"Start {GetType().Name}");
try
{
await ExecuteInner(context);
}
catch (Exception e)
{
logger.LogError(e, e.Message);
throw;
}
logger.LogDebug($"{GetType().Name} Finished");
}
}
}