* Uncomment Hangfire code

This commit is contained in:
2025-02-20 17:40:33 +01:00
parent 0bc80c589d
commit ed5b5634fd

View File

@@ -38,19 +38,19 @@ builder.Services.AddOpenApiDocument(config =>
config.Version = "v1";
});
// builder.Services.AddHangfire(config => config
// .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
// .UseSimpleAssemblyNameTypeSerializer()
// .UseRecommendedSerializerSettings()
// .UseSqlServerStorage(builder.Configuration.GetConnectionString("OrdersManagementConnection"), new SqlServerStorageOptions
// {
// CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
// SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
// QueuePollInterval = TimeSpan.Zero,
// UseRecommendedIsolationLevel = true,
// DisableGlobalLocks = true
// }));
// builder.Services.AddHangfireServer();
builder.Services.AddHangfire(config => config
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(builder.Configuration.GetConnectionString("OrdersManagementConnection"), new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
DisableGlobalLocks = true
}));
builder.Services.AddHangfireServer();
// Configure AutoMapper
builder.Services.AddAutoMapper(typeof(FaKrosnoMappingProfile), typeof(SytelineSaAppMappingProfile),
@@ -88,7 +88,7 @@ builder.Services.AddScoped<IRoleService, RoleService>();
builder.Services.AddScoped<IFunctionService, FunctionService>();
builder.Services.AddScoped<IUserRoleService, UserRoleService>();
//builder.Services.AddHostedService<TimedHostedService>();
builder.Services.AddHostedService<TimedHostedService>();
var app = builder.Build();
@@ -102,7 +102,7 @@ app.UseAuthorization();
app.MapControllers();
//app.UseHangfireDashboard();
app.UseHangfireDashboard();
// var scopeFactory = app.Services.GetRequiredService<IServiceScopeFactory>();
// using (var scope = scopeFactory.CreateScope())