Add hangfire

This commit is contained in:
Michał Zieliński
2025-10-12 18:28:14 +02:00
parent de5b8fbe16
commit b24aaab679
6 changed files with 152 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using BimAI.Infrastructure.Sync;
using Microsoft.Extensions.Logging;
namespace BimAI.Infrastructure.Jobs;
public class ProductSyncJob
{
private readonly ProductSyncService _productSyncService;
private readonly ILogger<ProductSyncJob> _logger;
public ProductSyncJob(ProductSyncService productSyncService, ILogger<ProductSyncJob> logger)
{
_productSyncService = productSyncService;
_logger = logger;
}
public async Task ExecuteAsync()
{
_logger.LogInformation("Starting product sync...");
try
{
await _productSyncService.RunAsync();
_logger.LogInformation("Product sync finished.");
} catch (Exception ex)
{
_logger.LogError(ex, "Error during product sync.");
throw;
}
}
}